Struct WasiSocketsCtxView

Source
pub struct WasiSocketsCtxView<'a> {
    pub ctx: &'a mut WasiSocketsCtx,
    pub table: &'a mut ResourceTable,
}

Fields§

§ctx: &'a mut WasiSocketsCtx§table: &'a mut ResourceTable

Trait Implementations§

Source§

impl Host for WasiSocketsCtxView<'_>

Source§

fn instance_network(&mut self) -> Result<Resource<Network>, Error>

Get a handle to the default network.
Source§

impl Host for WasiSocketsCtxView<'_>

Source§

fn convert_error_code(&mut self, error: SocketError) -> Result<ErrorCode>

Source§

fn network_error_code( &mut self, err: Resource<Error>, ) -> Result<Option<ErrorCode>>

Attempts to extract a network-related error-code from the stream error provided. Read more
Source§

impl Host for WasiSocketsCtxView<'_>

Source§

fn create_tcp_socket( &mut self, address_family: IpAddressFamily, ) -> SocketResult<Resource<TcpSocket>>

Create a new TCP socket. Read more
Source§

impl Host for WasiSocketsCtxView<'_>

Source§

fn create_udp_socket( &mut self, address_family: IpAddressFamily, ) -> SocketResult<Resource<UdpSocket>>

Create a new UDP socket. Read more
Source§

impl Host for WasiSocketsCtxView<'_>

Source§

fn resolve_addresses( &mut self, network: Resource<Network>, name: String, ) -> Result<Resource<ResolveAddressStream>, SocketError>

Resolve an internet host name to a list of IP addresses. Read more
Source§

impl HostIncomingDatagramStream for WasiSocketsCtxView<'_>

Source§

fn receive( &mut self, this: Resource<IncomingDatagramStream>, max_results: u64, ) -> SocketResult<Vec<IncomingDatagram>>

Receive messages on the socket. Read more
Source§

fn subscribe( &mut self, this: Resource<IncomingDatagramStream>, ) -> Result<Resource<DynPollable>>

Create a pollable which will resolve once the stream is ready to receive again. Read more
Source§

fn drop(&mut self, this: Resource<IncomingDatagramStream>) -> Result<(), Error>

Source§

impl HostIncomingDatagramStream for WasiSocketsCtxView<'_>

Source§

fn receive( &mut self, self_: Resource<IncomingDatagramStream>, max_results: u64, ) -> Result<Vec<IncomingDatagram>, SocketError>

Receive messages on the socket. Read more
Source§

fn subscribe( &mut self, self_: Resource<IncomingDatagramStream>, ) -> Result<Resource<Pollable>>

Create a pollable which will resolve once the stream is ready to receive again. Read more
Source§

fn drop(&mut self, rep: Resource<IncomingDatagramStream>) -> Result<()>

Source§

impl HostNetwork for WasiSocketsCtxView<'_>

Source§

fn drop(&mut self, this: Resource<Network>) -> Result<(), Error>

Source§

impl HostOutgoingDatagramStream for WasiSocketsCtxView<'_>

Source§

fn check_send( &mut self, this: Resource<OutgoingDatagramStream>, ) -> SocketResult<u64>

Check readiness for sending. This function never blocks. Read more
Source§

async fn send( &mut self, this: Resource<OutgoingDatagramStream>, datagrams: Vec<OutgoingDatagram>, ) -> SocketResult<u64>

Send messages on the socket. Read more
Source§

fn subscribe( &mut self, this: Resource<OutgoingDatagramStream>, ) -> Result<Resource<DynPollable>>

Create a pollable which will resolve once the stream is ready to send again. Read more
Source§

fn drop(&mut self, this: Resource<OutgoingDatagramStream>) -> Result<(), Error>

Source§

impl HostOutgoingDatagramStream for WasiSocketsCtxView<'_>

Source§

fn check_send( &mut self, self_: Resource<OutgoingDatagramStream>, ) -> Result<u64, SocketError>

Check readiness for sending. This function never blocks. Read more
Source§

fn send( &mut self, self_: Resource<OutgoingDatagramStream>, datagrams: Vec<OutgoingDatagram>, ) -> Result<u64, SocketError>

Send messages on the socket. Read more
Source§

fn subscribe( &mut self, self_: Resource<OutgoingDatagramStream>, ) -> Result<Resource<Pollable>>

Create a pollable which will resolve once the stream is ready to send again. Read more
Source§

fn drop(&mut self, rep: Resource<OutgoingDatagramStream>) -> Result<()>

Source§

impl HostResolveAddressStream for WasiSocketsCtxView<'_>

Source§

fn resolve_next_address( &mut self, resource: Resource<ResolveAddressStream>, ) -> Result<Option<IpAddress>, SocketError>

Returns the next address from the resolver. Read more
Source§

fn subscribe( &mut self, resource: Resource<ResolveAddressStream>, ) -> Result<Resource<DynPollable>>

Create a pollable which will resolve once the stream is ready for I/O. Read more
Source§

fn drop(&mut self, resource: Resource<ResolveAddressStream>) -> Result<()>

Source§

impl HostTcpSocket for WasiSocketsCtxView<'_>

Source§

async fn start_bind( &mut self, this: Resource<TcpSocket>, network: Resource<Network>, local_address: IpSocketAddress, ) -> SocketResult<()>

Bind the socket to a specific network on the provided IP address and port. Read more
Source§

fn finish_bind(&mut self, this: Resource<TcpSocket>) -> SocketResult<()>

Source§

async fn start_connect( &mut self, this: Resource<TcpSocket>, network: Resource<Network>, remote_address: IpSocketAddress, ) -> SocketResult<()>

Connect to a remote endpoint. Read more
Source§

fn finish_connect( &mut self, this: Resource<TcpSocket>, ) -> SocketResult<(Resource<DynInputStream>, Resource<DynOutputStream>)>

Source§

fn start_listen(&mut self, this: Resource<TcpSocket>) -> SocketResult<()>

Start listening for new connections. Read more
Source§

fn finish_listen(&mut self, this: Resource<TcpSocket>) -> SocketResult<()>

Source§

fn accept( &mut self, this: Resource<TcpSocket>, ) -> SocketResult<(Resource<TcpSocket>, Resource<DynInputStream>, Resource<DynOutputStream>)>

Accept a new client socket. Read more
Source§

fn local_address( &mut self, this: Resource<TcpSocket>, ) -> SocketResult<IpSocketAddress>

Get the bound local address. Read more
Source§

fn remote_address( &mut self, this: Resource<TcpSocket>, ) -> SocketResult<IpSocketAddress>

Get the remote address. Read more
Source§

fn is_listening(&mut self, this: Resource<TcpSocket>) -> Result<bool, Error>

Whether the socket is in the listening state. Read more
Source§

fn address_family( &mut self, this: Resource<TcpSocket>, ) -> Result<IpAddressFamily, Error>

Whether this is a IPv4 or IPv6 socket. Read more
Source§

fn set_listen_backlog_size( &mut self, this: Resource<TcpSocket>, value: u64, ) -> SocketResult<()>

Hints the desired listen queue size. Implementations are free to ignore this. Read more
Source§

fn keep_alive_enabled( &mut self, this: Resource<TcpSocket>, ) -> SocketResult<bool>

Enables or disables keepalive. Read more
Source§

fn set_keep_alive_enabled( &mut self, this: Resource<TcpSocket>, value: bool, ) -> SocketResult<()>

Source§

fn keep_alive_idle_time( &mut self, this: Resource<TcpSocket>, ) -> SocketResult<u64>

Amount of time the connection has to be idle before TCP starts sending keepalive packets. Read more
Source§

fn set_keep_alive_idle_time( &mut self, this: Resource<TcpSocket>, value: u64, ) -> SocketResult<()>

Source§

fn keep_alive_interval( &mut self, this: Resource<TcpSocket>, ) -> SocketResult<u64>

The time between keepalive packets. Read more
Source§

fn set_keep_alive_interval( &mut self, this: Resource<TcpSocket>, value: u64, ) -> SocketResult<()>

Source§

fn keep_alive_count(&mut self, this: Resource<TcpSocket>) -> SocketResult<u32>

The maximum amount of keepalive packets TCP should send before aborting the connection. Read more
Source§

fn set_keep_alive_count( &mut self, this: Resource<TcpSocket>, value: u32, ) -> SocketResult<()>

Source§

fn hop_limit(&mut self, this: Resource<TcpSocket>) -> SocketResult<u8>

Equivalent to the IP_TTL & IPV6_UNICAST_HOPS socket options. Read more
Source§

fn set_hop_limit( &mut self, this: Resource<TcpSocket>, value: u8, ) -> SocketResult<()>

Source§

fn receive_buffer_size( &mut self, this: Resource<TcpSocket>, ) -> SocketResult<u64>

The kernel buffer space reserved for sends/receives on this socket. Read more
Source§

fn set_receive_buffer_size( &mut self, this: Resource<TcpSocket>, value: u64, ) -> SocketResult<()>

Source§

fn send_buffer_size(&mut self, this: Resource<TcpSocket>) -> SocketResult<u64>

Source§

fn set_send_buffer_size( &mut self, this: Resource<TcpSocket>, value: u64, ) -> SocketResult<()>

Source§

fn subscribe( &mut self, this: Resource<TcpSocket>, ) -> Result<Resource<DynPollable>>

Create a pollable which can be used to poll for, or block on, completion of any of the asynchronous operations of this socket. Read more
Source§

fn shutdown( &mut self, this: Resource<TcpSocket>, shutdown_type: ShutdownType, ) -> SocketResult<()>

Initiate a graceful shutdown. Read more
Source§

fn drop(&mut self, this: Resource<TcpSocket>) -> Result<(), Error>

Source§

impl HostTcpSocket for WasiSocketsCtxView<'_>

Source§

fn start_bind( &mut self, self_: Resource<TcpSocket>, network: Resource<Network>, local_address: IpSocketAddress, ) -> Result<(), SocketError>

Bind the socket to a specific network on the provided IP address and port. Read more
Source§

fn finish_bind(&mut self, self_: Resource<TcpSocket>) -> Result<(), SocketError>

Source§

fn start_connect( &mut self, self_: Resource<TcpSocket>, network: Resource<Network>, remote_address: IpSocketAddress, ) -> Result<(), SocketError>

Connect to a remote endpoint. Read more
Source§

fn finish_connect( &mut self, self_: Resource<TcpSocket>, ) -> Result<(Resource<InputStream>, Resource<OutputStream>), SocketError>

Source§

fn start_listen( &mut self, self_: Resource<TcpSocket>, ) -> Result<(), SocketError>

Start listening for new connections. Read more
Source§

fn finish_listen( &mut self, self_: Resource<TcpSocket>, ) -> Result<(), SocketError>

Source§

fn accept( &mut self, self_: Resource<TcpSocket>, ) -> Result<(Resource<TcpSocket>, Resource<InputStream>, Resource<OutputStream>), SocketError>

Accept a new client socket. Read more
Source§

fn local_address( &mut self, self_: Resource<TcpSocket>, ) -> Result<IpSocketAddress, SocketError>

Get the bound local address. Read more
Source§

fn remote_address( &mut self, self_: Resource<TcpSocket>, ) -> Result<IpSocketAddress, SocketError>

Get the remote address. Read more
Source§

fn is_listening(&mut self, self_: Resource<TcpSocket>) -> Result<bool>

Whether the socket is in the listening state. Read more
Source§

fn address_family( &mut self, self_: Resource<TcpSocket>, ) -> Result<IpAddressFamily>

Whether this is a IPv4 or IPv6 socket. Read more
Source§

fn set_listen_backlog_size( &mut self, self_: Resource<TcpSocket>, value: u64, ) -> Result<(), SocketError>

Hints the desired listen queue size. Implementations are free to ignore this. Read more
Source§

fn keep_alive_enabled( &mut self, self_: Resource<TcpSocket>, ) -> Result<bool, SocketError>

Enables or disables keepalive. Read more
Source§

fn set_keep_alive_enabled( &mut self, self_: Resource<TcpSocket>, value: bool, ) -> Result<(), SocketError>

Source§

fn keep_alive_idle_time( &mut self, self_: Resource<TcpSocket>, ) -> Result<Duration, SocketError>

Amount of time the connection has to be idle before TCP starts sending keepalive packets. Read more
Source§

fn set_keep_alive_idle_time( &mut self, self_: Resource<TcpSocket>, value: Duration, ) -> Result<(), SocketError>

Source§

fn keep_alive_interval( &mut self, self_: Resource<TcpSocket>, ) -> Result<Duration, SocketError>

The time between keepalive packets. Read more
Source§

fn set_keep_alive_interval( &mut self, self_: Resource<TcpSocket>, value: Duration, ) -> Result<(), SocketError>

Source§

fn keep_alive_count( &mut self, self_: Resource<TcpSocket>, ) -> Result<u32, SocketError>

The maximum amount of keepalive packets TCP should send before aborting the connection. Read more
Source§

fn set_keep_alive_count( &mut self, self_: Resource<TcpSocket>, value: u32, ) -> Result<(), SocketError>

Source§

fn hop_limit(&mut self, self_: Resource<TcpSocket>) -> Result<u8, SocketError>

Equivalent to the IP_TTL & IPV6_UNICAST_HOPS socket options. Read more
Source§

fn set_hop_limit( &mut self, self_: Resource<TcpSocket>, value: u8, ) -> Result<(), SocketError>

Source§

fn receive_buffer_size( &mut self, self_: Resource<TcpSocket>, ) -> Result<u64, SocketError>

The kernel buffer space reserved for sends/receives on this socket. Read more
Source§

fn set_receive_buffer_size( &mut self, self_: Resource<TcpSocket>, value: u64, ) -> Result<(), SocketError>

Source§

fn send_buffer_size( &mut self, self_: Resource<TcpSocket>, ) -> Result<u64, SocketError>

Source§

fn set_send_buffer_size( &mut self, self_: Resource<TcpSocket>, value: u64, ) -> Result<(), SocketError>

Source§

fn subscribe( &mut self, self_: Resource<TcpSocket>, ) -> Result<Resource<Pollable>>

Create a pollable which can be used to poll for, or block on, completion of any of the asynchronous operations of this socket. Read more
Source§

fn shutdown( &mut self, self_: Resource<TcpSocket>, shutdown_type: ShutdownType, ) -> Result<(), SocketError>

Initiate a graceful shutdown. Read more
Source§

fn drop(&mut self, rep: Resource<TcpSocket>) -> Result<()>

Source§

impl HostUdpSocket for WasiSocketsCtxView<'_>

Source§

async fn start_bind( &mut self, this: Resource<UdpSocket>, network: Resource<Network>, local_address: IpSocketAddress, ) -> SocketResult<()>

Bind the socket to a specific network on the provided IP address and port. Read more
Source§

fn finish_bind(&mut self, this: Resource<UdpSocket>) -> SocketResult<()>

Source§

async fn stream( &mut self, this: Resource<UdpSocket>, remote_address: Option<IpSocketAddress>, ) -> SocketResult<(Resource<IncomingDatagramStream>, Resource<OutgoingDatagramStream>)>

Set up inbound & outbound communication channels, optionally to a specific peer. Read more
Source§

fn local_address( &mut self, this: Resource<UdpSocket>, ) -> SocketResult<IpSocketAddress>

Get the current bound address. Read more
Source§

fn remote_address( &mut self, this: Resource<UdpSocket>, ) -> SocketResult<IpSocketAddress>

Get the address the socket is currently streaming to. Read more
Source§

fn address_family( &mut self, this: Resource<UdpSocket>, ) -> Result<IpAddressFamily, Error>

Whether this is a IPv4 or IPv6 socket. Read more
Source§

fn unicast_hop_limit(&mut self, this: Resource<UdpSocket>) -> SocketResult<u8>

Equivalent to the IP_TTL & IPV6_UNICAST_HOPS socket options. Read more
Source§

fn set_unicast_hop_limit( &mut self, this: Resource<UdpSocket>, value: u8, ) -> SocketResult<()>

Source§

fn receive_buffer_size( &mut self, this: Resource<UdpSocket>, ) -> SocketResult<u64>

The kernel buffer space reserved for sends/receives on this socket. Read more
Source§

fn set_receive_buffer_size( &mut self, this: Resource<UdpSocket>, value: u64, ) -> SocketResult<()>

Source§

fn send_buffer_size(&mut self, this: Resource<UdpSocket>) -> SocketResult<u64>

Source§

fn set_send_buffer_size( &mut self, this: Resource<UdpSocket>, value: u64, ) -> SocketResult<()>

Source§

fn subscribe( &mut self, this: Resource<UdpSocket>, ) -> Result<Resource<DynPollable>>

Create a pollable which will resolve once the socket is ready for I/O. Read more
Source§

fn drop(&mut self, this: Resource<UdpSocket>) -> Result<(), Error>

Source§

impl HostUdpSocket for WasiSocketsCtxView<'_>

Source§

fn start_bind( &mut self, self_: Resource<UdpSocket>, network: Resource<Network>, local_address: IpSocketAddress, ) -> Result<(), SocketError>

Bind the socket to a specific network on the provided IP address and port. Read more
Source§

fn finish_bind(&mut self, self_: Resource<UdpSocket>) -> Result<(), SocketError>

Source§

fn stream( &mut self, self_: Resource<UdpSocket>, remote_address: Option<IpSocketAddress>, ) -> Result<(Resource<IncomingDatagramStream>, Resource<OutgoingDatagramStream>), SocketError>

Set up inbound & outbound communication channels, optionally to a specific peer. Read more
Source§

fn local_address( &mut self, self_: Resource<UdpSocket>, ) -> Result<IpSocketAddress, SocketError>

Get the current bound address. Read more
Source§

fn remote_address( &mut self, self_: Resource<UdpSocket>, ) -> Result<IpSocketAddress, SocketError>

Get the address the socket is currently streaming to. Read more
Source§

fn address_family( &mut self, self_: Resource<UdpSocket>, ) -> Result<IpAddressFamily>

Whether this is a IPv4 or IPv6 socket. Read more
Source§

fn unicast_hop_limit( &mut self, self_: Resource<UdpSocket>, ) -> Result<u8, SocketError>

Equivalent to the IP_TTL & IPV6_UNICAST_HOPS socket options. Read more
Source§

fn set_unicast_hop_limit( &mut self, self_: Resource<UdpSocket>, value: u8, ) -> Result<(), SocketError>

Source§

fn receive_buffer_size( &mut self, self_: Resource<UdpSocket>, ) -> Result<u64, SocketError>

The kernel buffer space reserved for sends/receives on this socket. Read more
Source§

fn set_receive_buffer_size( &mut self, self_: Resource<UdpSocket>, value: u64, ) -> Result<(), SocketError>

Source§

fn send_buffer_size( &mut self, self_: Resource<UdpSocket>, ) -> Result<u64, SocketError>

Source§

fn set_send_buffer_size( &mut self, self_: Resource<UdpSocket>, value: u64, ) -> Result<(), SocketError>

Source§

fn subscribe( &mut self, self_: Resource<UdpSocket>, ) -> Result<Resource<Pollable>>

Create a pollable which will resolve once the socket is ready for I/O. Read more
Source§

fn drop(&mut self, rep: Resource<UdpSocket>) -> Result<()>

Source§

impl Host for WasiSocketsCtxView<'_>

Source§

impl Host for WasiSocketsCtxView<'_>

Source§

impl Host for WasiSocketsCtxView<'_>

Source§

impl Host for WasiSocketsCtxView<'_>

Auto Trait Implementations§

§

impl<'a> Freeze for WasiSocketsCtxView<'a>

§

impl<'a> !RefUnwindSafe for WasiSocketsCtxView<'a>

§

impl<'a> Send for WasiSocketsCtxView<'a>

§

impl<'a> !Sync for WasiSocketsCtxView<'a>

§

impl<'a> Unpin for WasiSocketsCtxView<'a>

§

impl<'a> !UnwindSafe for WasiSocketsCtxView<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> GetSetFdFlags for T

§

fn get_fd_flags(&self) -> Result<FdFlags, Error>
where T: AsFilelike,

Query the “status” flags for the self file descriptor.
§

fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>
where T: AsFilelike,

Create a new SetFdFlags value for use with set_fd_flags. Read more
§

fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>
where T: AsFilelike,

Set the “status” flags for the self file descriptor. Read more
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> Pointee for T

§

type Pointer = u32

§

fn debug( pointer: <T as Pointee>::Pointer, f: &mut Formatter<'_>, ) -> Result<(), Error>

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
§

impl<T> ErasedDestructor for T
where T: 'static,

§

impl<T> MaybeSendSync for T