Sha256: 25465ea28b12461e721bff291e5a90c5adac3e4cf35a4d744235d557f4c501c8

Contents?: true

Size: 1.26 KB

Versions: 8

Compression:

Stored size: 1.26 KB

Contents

//! Both `kqueue(2)` and `epoll(2)` don't need to hold any user space state.

use std::io;
use std::os::fd::RawFd;

use crate::{Interest, Registry, Token};

pub(crate) struct IoSourceState;

impl IoSourceState {
    pub(crate) fn new() -> IoSourceState {
        IoSourceState
    }

    pub(crate) fn do_io<T, F, R>(&self, f: F, io: &T) -> io::Result<R>
    where
        F: FnOnce(&T) -> io::Result<R>,
    {
        // We don't hold state, so we can just call the function and
        // return.
        f(io)
    }

    pub(crate) fn register(
        &mut self,
        registry: &Registry,
        token: Token,
        interests: Interest,
        fd: RawFd,
    ) -> io::Result<()> {
        // Pass through, we don't have any state.
        registry.selector().register(fd, token, interests)
    }

    pub(crate) fn reregister(
        &mut self,
        registry: &Registry,
        token: Token,
        interests: Interest,
        fd: RawFd,
    ) -> io::Result<()> {
        // Pass through, we don't have any state.
        registry.selector().reregister(fd, token, interests)
    }

    pub(crate) fn deregister(&mut self, registry: &Registry, fd: RawFd) -> io::Result<()> {
        // Pass through, we don't have any state.
        registry.selector().deregister(fd)
    }
}

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
wasmtime-29.0.0 ./ext/cargo-vendor/mio-1.0.3/src/sys/unix/selector/stateless_io_source.rs
wasmtime-28.0.0 ./ext/cargo-vendor/mio-1.0.3/src/sys/unix/selector/stateless_io_source.rs
wasmtime-27.0.0 ./ext/cargo-vendor/mio-1.0.2/src/sys/unix/selector/stateless_io_source.rs
wasmtime-26.0.0 ./ext/cargo-vendor/mio-1.0.2/src/sys/unix/selector/stateless_io_source.rs
wasmtime-25.0.2 ./ext/cargo-vendor/mio-1.0.2/src/sys/unix/selector/stateless_io_source.rs
wasmtime-25.0.1 ./ext/cargo-vendor/mio-1.0.2/src/sys/unix/selector/stateless_io_source.rs
wasmtime-25.0.0 ./ext/cargo-vendor/mio-1.0.2/src/sys/unix/selector/stateless_io_source.rs
wasmtime-24.0.0 ./ext/cargo-vendor/mio-1.0.2/src/sys/unix/selector/stateless_io_source.rs