Struct Ctx

Source
pub struct Ctx {
Show 13 fields pub table: ResourceTable, pub http: WasiHttpCtx, pub init_at: u64, pub environment: Vec<(String, String)>, pub arguments: Vec<String>, pub initial_cwd: Option<String>, pub stdin: InputStream, pub stdout: OutputStream, pub stderr: OutputStream, pub filesystem: WasiFilesystemCtx, pub random: WasiRandomCtx, pub shutdown: Receiver<u64>, pub deadline: u64,
}

Fields§

§table: ResourceTable§http: WasiHttpCtx§init_at: u64§environment: Vec<(String, String)>§arguments: Vec<String>§initial_cwd: Option<String>§stdin: InputStream§stdout: OutputStream§stderr: OutputStream§filesystem: WasiFilesystemCtx§random: WasiRandomCtx§shutdown: Receiver<u64>

A deadline will be sent on this channel if shutdown is requested

§deadline: u64

If set to a non-zero value, this is the execution time deadline. The component invocation will trap if it is reached.

Implementations§

Source§

impl Ctx

Source

pub fn new(deadline: u64, shutdown: Receiver<u64>) -> Self

Trait Implementations§

Source§

impl CabishView for Ctx

Source§

fn table(&mut self) -> &mut ResourceTable

Source§

impl Debug for Ctx

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Host for Ctx

Source§

fn now(&mut self) -> Result<Datetime>

Read the current value of the clock. Read more
Source§

fn resolution(&mut self) -> Result<Datetime>

Query the resolution of the clock. Read more
Source§

impl Host for Ctx

Source§

fn now(&mut self) -> Result<Instant>

Read the current value of the clock. Read more
Source§

fn resolution(&mut self) -> Result<Instant>

Query the resolution of the clock. Returns the duration of time corresponding to a clock tick.
Source§

fn subscribe_instant(&mut self, when: Instant) -> Result<Resource<Pollable>>

Create a pollable which will resolve once the specified instant has occurred.
Source§

fn subscribe_duration( &mut self, duration: Duration, ) -> Result<Resource<Pollable>>

Create a pollable that will resolve after the specified duration has elapsed from the time this function is invoked.
Source§

impl Host for Ctx

Source§

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

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

impl Host for Ctx

Source§

fn get_directories(&mut self) -> Result<Vec<(Resource<Descriptor>, String)>>

Return the set of preopened directories, and their paths.
Source§

impl Host for Ctx

Source§

fn handle( &mut self, _request: Resource<OutgoingRequest>, _options: Option<Resource<WithChildren<RequestOptions>>>, ) -> Result<Result<Resource<FutureIncomingResponse>, ErrorCode>>

This function is invoked with an outgoing HTTP Request, and it returns a resource future-incoming-response which represents an HTTP Response which may arrive in the future. Read more
Source§

impl Host for Ctx

Source§

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

Attempts to extract a http-related error from the wasi:io error provided. Read more
Source§

impl Host for Ctx

Source§

async fn poll(&mut self, pollables: Vec<Resource<Pollable>>) -> Result<Vec<u32>>

Poll for completion on a set of pollables. Read more
Source§

impl Host for Ctx

Source§

fn get_random_bytes(&mut self, len: u64) -> Result<Vec<u8>>

Return len cryptographically-secure random or pseudo-random bytes. Read more
Source§

fn get_random_u64(&mut self) -> Result<u64>

Return a cryptographically-secure random or pseudo-random u64 value. Read more
Source§

impl Host for Ctx

Source§

fn get_terminal_stdin(&mut self) -> Result<Option<Resource<TerminalInput>>>

If stdin is connected to a terminal, return a terminal-input handle allowing further interaction with it.
Source§

impl Host for Ctx

Source§

fn get_insecure_random_bytes(&mut self, len: u64) -> Result<Vec<u8>>

Return len insecure pseudo-random bytes. Read more
Source§

fn get_insecure_random_u64(&mut self) -> Result<u64>

Return an insecure pseudo-random u64 value. Read more
Source§

impl Host for Ctx

Source§

fn insecure_seed(&mut self) -> Result<(u64, u64)>

Return a 128-bit value that may contain a pseudo-random value. Read more
Source§

impl Host for Ctx

Source§

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

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

impl Host for Ctx

Source§

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

Get a handle to the default network.
Source§

impl Host for Ctx

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 Ctx

Source§

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

Create a new TCP socket. Read more
Source§

impl Host for Ctx

Source§

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

Create a new UDP socket. Read more
Source§

impl Host for Ctx

Source§

fn get_terminal_stdout(&mut self) -> Result<Option<Resource<TerminalOutput>>>

If stdout is connected to a terminal, return a terminal-output handle allowing further interaction with it.
Source§

impl Host for Ctx

Source§

fn get_terminal_stderr(&mut self) -> Result<Option<Resource<TerminalOutput>>>

If stderr is connected to a terminal, return a terminal-output handle allowing further interaction with it.
Source§

impl Host for Ctx

Source§

impl Host for Ctx

Source§

impl Host for Ctx

Source§

impl Host for Ctx

Source§

fn get_environment(&mut self) -> Result<Vec<(String, String)>>

Get the POSIX-style environment variables. Read more
Source§

fn get_arguments(&mut self) -> Result<Vec<String>>

Get the POSIX-style arguments to the program.
Source§

fn initial_cwd(&mut self) -> Result<Option<String>>

Return a path that programs should use as their initial current working directory, interpreting . as shorthand for this.
Source§

impl Host for Ctx

Source§

fn exit(&mut self, status: Result<(), ()>) -> Result<()>

Exit the current instance and any linked instances.
Source§

fn exit_with_code(&mut self, status_code: u8) -> Result<()>

Exit the current instance and any linked instances, reporting the specified status code to the host. Read more
Source§

impl HostDescriptor for Ctx

Source§

fn read_via_stream( &mut self, self_: Resource<Descriptor>, offset: Filesize, ) -> Result<Result<Resource<InputStream>, ErrorCode>>

Return a stream for reading from a file, if available. Read more
Source§

fn write_via_stream( &mut self, self_: Resource<Descriptor>, offset: Filesize, ) -> Result<Result<Resource<OutputStream>, ErrorCode>>

Return a stream for writing to a file, if available. Read more
Source§

fn append_via_stream( &mut self, self_: Resource<Descriptor>, ) -> Result<Result<Resource<OutputStream>, ErrorCode>>

Return a stream for appending to a file, if available. Read more
Source§

fn advise( &mut self, self_: Resource<Descriptor>, offset: Filesize, length: Filesize, advice: Advice, ) -> Result<Result<(), ErrorCode>>

Provide file advisory information on a descriptor. Read more
Source§

fn sync_data( &mut self, self_: Resource<Descriptor>, ) -> Result<Result<(), ErrorCode>>

Synchronize the data of a file to disk. Read more
Source§

fn get_flags( &mut self, self_: Resource<Descriptor>, ) -> Result<Result<DescriptorFlags, ErrorCode>>

Get flags associated with a descriptor. Read more
Source§

fn get_type( &mut self, self_: Resource<Descriptor>, ) -> Result<Result<DescriptorType, ErrorCode>>

Get the dynamic type of a descriptor. Read more
Source§

fn set_size( &mut self, self_: Resource<Descriptor>, size: Filesize, ) -> Result<Result<(), ErrorCode>>

Adjust the size of an open file. If this increases the file’s size, the extra bytes are filled with zeros. Read more
Source§

fn set_times( &mut self, self_: Resource<Descriptor>, data_access_timestamp: NewTimestamp, data_modification_timestamp: NewTimestamp, ) -> Result<Result<(), ErrorCode>>

Adjust the timestamps of an open file or directory. Read more
Source§

fn read( &mut self, self_: Resource<Descriptor>, length: Filesize, offset: Filesize, ) -> Result<Result<(Vec<u8>, bool), ErrorCode>>

Read from a descriptor, without using and updating the descriptor’s offset. Read more
Source§

fn write( &mut self, self_: Resource<Descriptor>, buffer: Vec<u8>, offset: Filesize, ) -> Result<Result<Filesize, ErrorCode>>

Write to a descriptor, without using and updating the descriptor’s offset. Read more
Source§

fn read_directory( &mut self, self_: Resource<Descriptor>, ) -> Result<Result<Resource<DirectoryEntryStream>, ErrorCode>>

Read directory entries from a directory. Read more
Source§

fn sync(&mut self, self_: Resource<Descriptor>) -> Result<Result<(), ErrorCode>>

Synchronize the data and metadata of a file to disk. Read more
Source§

fn create_directory_at( &mut self, self_: Resource<Descriptor>, path: String, ) -> Result<Result<(), ErrorCode>>

Create a directory. Read more
Source§

fn stat( &mut self, self_: Resource<Descriptor>, ) -> Result<Result<DescriptorStat, ErrorCode>>

Return the attributes of an open file or directory. Read more
Source§

fn stat_at( &mut self, self_: Resource<Descriptor>, path_flags: PathFlags, path: String, ) -> Result<Result<DescriptorStat, ErrorCode>>

Return the attributes of a file or directory. Read more
Source§

fn set_times_at( &mut self, self_: Resource<Descriptor>, path_flags: PathFlags, path: String, data_access_timestamp: NewTimestamp, data_modification_timestamp: NewTimestamp, ) -> Result<Result<(), ErrorCode>>

Adjust the timestamps of a file or directory. Read more
Create a hard link. Read more
Source§

fn open_at( &mut self, self_: Resource<Descriptor>, path_flags: PathFlags, path: String, open_flags: OpenFlags, flags: DescriptorFlags, ) -> Result<Result<Resource<Descriptor>, ErrorCode>>

Open a file or directory. Read more
Read the contents of a symbolic link. Read more
Source§

fn remove_directory_at( &mut self, self_: Resource<Descriptor>, path: String, ) -> Result<Result<(), ErrorCode>>

Remove a directory. Read more
Source§

fn rename_at( &mut self, self_: Resource<Descriptor>, old_path: String, new_descriptor: Resource<Descriptor>, new_path: String, ) -> Result<Result<(), ErrorCode>>

Rename a filesystem object. Read more
Create a symbolic link (also known as a “symlink”). Read more
Unlink a filesystem object that is not a directory. Read more
Source§

fn is_same_object( &mut self, self_: Resource<Descriptor>, other: Resource<Descriptor>, ) -> Result<bool>

Test whether two descriptors refer to the same filesystem object. Read more
Source§

fn metadata_hash( &mut self, self_: Resource<Descriptor>, ) -> Result<Result<MetadataHashValue, ErrorCode>>

Return a hash of the metadata associated with a filesystem object referred to by a descriptor. Read more
Source§

fn metadata_hash_at( &mut self, self_: Resource<Descriptor>, path_flags: PathFlags, path: String, ) -> Result<Result<MetadataHashValue, ErrorCode>>

Return a hash of the metadata associated with a filesystem object referred to by a directory descriptor and a relative path. Read more
Source§

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

Source§

impl HostDirectoryEntryStream for Ctx

Source§

fn read_directory_entry( &mut self, self_: Resource<DirectoryEntryStream>, ) -> Result<Result<Option<DirectoryEntry>, ErrorCode>>

Read a single directory entry from a directory-entry-stream.
Source§

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

Source§

impl HostError for Ctx

Source§

fn to_debug_string(&mut self, err: Resource<Error>) -> Result<String>

Returns a string that is suitable to assist humans in debugging this error. Read more
Source§

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

Source§

impl HostFields for Ctx

Source§

fn new(&mut self) -> Result<Resource<WithChildren<HeaderMap>>>

Construct an empty HTTP Fields. Read more
Source§

fn from_list( &mut self, entries: Vec<(FieldName, FieldValue)>, ) -> Result<Result<Resource<WithChildren<HeaderMap>>, HeaderError>>

Construct an HTTP Fields. Read more
Source§

fn get( &mut self, fields: Resource<WithChildren<HeaderMap>>, name: FieldName, ) -> Result<Vec<FieldValue>>

Get all of the values corresponding to a name. If the name is not present in this fields or is syntactically invalid, an empty list is returned. However, if the name is present but empty, this is represented by a list with one or more empty field-values present.
Source§

fn has( &mut self, fields: Resource<WithChildren<HeaderMap>>, name: FieldName, ) -> Result<bool>

Returns true when the name is present in this fields. If the name is syntactically invalid, false is returned.
Source§

fn set( &mut self, fields: Resource<WithChildren<HeaderMap>>, name: FieldName, value: Vec<FieldValue>, ) -> Result<Result<(), HeaderError>>

Set all of the values for a name. Clears any existing values for that name, if they have been set. Read more
Source§

fn delete( &mut self, fields: Resource<WithChildren<HeaderMap>>, name: FieldName, ) -> Result<Result<(), HeaderError>>

Delete all values for a name. Does nothing if no values for the name exist. Read more
Source§

fn append( &mut self, fields: Resource<WithChildren<HeaderMap>>, name: FieldName, value: FieldValue, ) -> Result<Result<(), HeaderError>>

Append a value for a name. Does not change or delete any existing values for that name. Read more
Source§

fn entries( &mut self, fields: Resource<WithChildren<HeaderMap>>, ) -> Result<Vec<(FieldName, FieldValue)>>

Retrieve the full set of names and values in the Fields. Like the constructor, the list represents each name-value pair. Read more
Source§

fn clone( &mut self, fields: Resource<WithChildren<HeaderMap>>, ) -> Result<Resource<WithChildren<HeaderMap>>>

Make a deep copy of the Fields. Equivalent in behavior to calling the fields constructor on the return value of entries. The resulting fields is mutable.
Source§

fn drop(&mut self, fields: Resource<WithChildren<HeaderMap>>) -> Result<()>

Source§

impl HostFutureIncomingResponse for Ctx

Source§

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

Returns a pollable which becomes ready when either the Response has been received, or an error has occurred. When this pollable is ready, the get method will return some.
Source§

fn get( &mut self, self_: Resource<FutureIncomingResponse>, ) -> Result<Option<Result<Result<Resource<IncomingResponse>, ErrorCode>, ()>>>

Returns the incoming HTTP Response, or an error, once one is ready. Read more
Source§

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

Source§

impl HostFutureTrailers for Ctx

Source§

fn subscribe( &mut self, trailers: Resource<FutureTrailers>, ) -> Result<Resource<Pollable>>

Returns a pollable which becomes ready when either the trailers have been received, or an error has occurred. When this pollable is ready, the get method will return some.
Source§

fn get( &mut self, trailers: Resource<FutureTrailers>, ) -> Result<Option<Result<Result<Option<Resource<Trailers>>, ErrorCode>, ()>>>

Returns the contents of the trailers, or an error which occurred, once the future is ready. Read more
Source§

fn drop(&mut self, trailers: Resource<FutureTrailers>) -> Result<()>

Source§

impl HostIncomingBody for Ctx

Source§

fn stream( &mut self, body: Resource<IncomingBody>, ) -> Result<Result<Resource<InputStream>, ()>>

Returns the contents of the body, as a stream of bytes. Read more
Source§

fn finish( &mut self, body: Resource<IncomingBody>, ) -> Result<Resource<FutureTrailers>>

Takes ownership of incoming-body, and returns a future-trailers. This function will trap if the input-stream child is still alive.
Source§

fn drop(&mut self, body: Resource<IncomingBody>) -> Result<()>

Source§

impl HostIncomingDatagramStream for Ctx

Source§

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

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 HostIncomingRequest for Ctx

Source§

fn consume( &mut self, req: Resource<IncomingRequest>, ) -> Result<Result<Resource<IncomingBody>, ()>>

Gives the incoming-body associated with this request. Will only return success at most once, and subsequent calls will return error.
Source§

fn method(&mut self, req: Resource<IncomingRequest>) -> Result<Method>

Returns the method of the incoming request.
Source§

fn path_with_query( &mut self, req: Resource<IncomingRequest>, ) -> Result<Option<String>>

Returns the path with query parameters from the request, as a string.
Source§

fn scheme(&mut self, req: Resource<IncomingRequest>) -> Result<Option<Scheme>>

Returns the protocol scheme from the request.
Source§

fn authority( &mut self, req: Resource<IncomingRequest>, ) -> Result<Option<String>>

Returns the authority of the Request’s target URI, if present.
Source§

fn headers( &mut self, req: Resource<IncomingRequest>, ) -> Result<Resource<WithChildren<HeaderMap>>>

Get the headers associated with the request. Read more
Source§

fn drop(&mut self, req: Resource<IncomingRequest>) -> Result<()>

Source§

impl HostIncomingResponse for Ctx

Source§

fn status(&mut self, res: Resource<IncomingResponse>) -> Result<StatusCode>

Returns the status code from the incoming response.
Source§

fn consume( &mut self, self_: Resource<IncomingResponse>, ) -> Result<Result<Resource<IncomingBody>, ()>>

Returns the incoming body. May be called at most once. Returns error if called additional times.
Source§

fn headers( &mut self, res: Resource<IncomingResponse>, ) -> Result<Resource<WithChildren<HeaderMap>>>

Returns the headers from the incoming response. Read more
Source§

fn drop(&mut self, res: Resource<IncomingResponse>) -> Result<()>

Source§

impl HostInputStream for Ctx

Source§

fn read( &mut self, stream: Resource<InputStream>, len: u64, ) -> Result<Result<Vec<u8>, StreamError>>

Perform a non-blocking read from the stream. Read more
Source§

async fn blocking_read( &mut self, stream: Resource<InputStream>, len: u64, ) -> Result<Result<Vec<u8>, StreamError>>

Read bytes from a stream, after blocking until at least one byte can be read. Except for blocking, behavior is identical to read.
Source§

fn skip( &mut self, stream: Resource<InputStream>, len: u64, ) -> Result<Result<u64, StreamError>>

Skip bytes from a stream. Returns number of bytes skipped. Read more
Source§

async fn blocking_skip( &mut self, stream: Resource<InputStream>, len: u64, ) -> Result<Result<u64, StreamError>>

Skip bytes from a stream, after blocking until at least one byte can be skipped. Except for blocking behavior, identical to skip.
Source§

fn subscribe( &mut self, stream: Resource<InputStream>, ) -> Result<Resource<Pollable>>

Create a pollable which will resolve once either the specified stream has bytes available to read or the other end of the stream has been closed. The created pollable is a child resource of the input-stream. Implementations may trap if the input-stream is dropped before all derived pollables created with this function are dropped.
Source§

fn drop(&mut self, stream: Resource<InputStream>) -> Result<()>

Source§

impl HostNetwork for Ctx

Source§

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

Source§

impl HostOutgoingBody for Ctx

Source§

fn write( &mut self, body: Resource<Arc<Mutex<OutgoingBody>>>, ) -> Result<Result<Resource<OutputStream>, ()>>

Returns a stream for writing the body contents. Read more
Source§

fn finish( &mut self, body: Resource<Arc<Mutex<OutgoingBody>>>, trailers: Option<Resource<Trailers>>, ) -> Result<Result<(), ErrorCode>>

Finalize an outgoing body, optionally providing trailers. This must be called to signal that the response is complete. If the outgoing-body is dropped without calling outgoing-body.finalize, the implementation should treat the body as corrupted. Read more
Source§

fn drop(&mut self, body: Resource<Arc<Mutex<OutgoingBody>>>) -> Result<()>

Source§

impl HostOutgoingDatagramStream for Ctx

Source§

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

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

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

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 HostOutgoingRequest for Ctx

Source§

fn new( &mut self, headers: Resource<WithChildren<HeaderMap>>, ) -> Result<Resource<OutgoingRequest>>

Construct a new outgoing-request with a default method of GET, and none values for path-with-query, scheme, and authority. Read more
Source§

fn body( &mut self, self_: Resource<OutgoingRequest>, ) -> Result<Result<Resource<Arc<Mutex<OutgoingBody>>>, ()>>

Returns the resource corresponding to the outgoing Body for this Request. Read more
Source§

fn method(&mut self, req: Resource<OutgoingRequest>) -> Result<Method>

Get the Method for the Request.
Source§

fn set_method( &mut self, req: Resource<OutgoingRequest>, method: Method, ) -> Result<Result<(), ()>>

Set the Method for the Request. Fails if the string present in a method.other argument is not a syntactically valid method.
Source§

fn path_with_query( &mut self, req: Resource<OutgoingRequest>, ) -> Result<Option<String>>

Get the combination of the HTTP Path and Query for the Request. When none, this represents an empty Path and empty Query.
Source§

fn set_path_with_query( &mut self, req: Resource<OutgoingRequest>, path_with_query: Option<String>, ) -> Result<Result<(), ()>>

Set the combination of the HTTP Path and Query for the Request. When none, this represents an empty Path and empty Query. Fails is the string given is not a syntactically valid path and query uri component.
Source§

fn scheme(&mut self, req: Resource<OutgoingRequest>) -> Result<Option<Scheme>>

Get the HTTP Related Scheme for the Request. When none, the implementation may choose an appropriate default scheme.
Source§

fn set_scheme( &mut self, req: Resource<OutgoingRequest>, scheme: Option<Scheme>, ) -> Result<Result<(), ()>>

Set the HTTP Related Scheme for the Request. When none, the implementation may choose an appropriate default scheme. Fails if the string given is not a syntactically valid uri scheme.
Source§

fn authority( &mut self, req: Resource<OutgoingRequest>, ) -> Result<Option<String>>

Get the authority of the Request’s target URI. A value of none may be used with Related Schemes which do not require an authority. The HTTP and HTTPS schemes always require an authority.
Source§

fn set_authority( &mut self, req: Resource<OutgoingRequest>, authority: Option<String>, ) -> Result<Result<(), ()>>

Set the authority of the Request’s target URI. A value of none may be used with Related Schemes which do not require an authority. The HTTP and HTTPS schemes always require an authority. Fails if the string given is not a syntactically valid URI authority.
Source§

fn headers( &mut self, req: Resource<OutgoingRequest>, ) -> Result<Resource<WithChildren<HeaderMap>>>

Get the headers associated with the Request. Read more
Source§

fn drop(&mut self, req: Resource<OutgoingRequest>) -> Result<()>

Source§

impl HostOutgoingResponse for Ctx

Source§

fn new( &mut self, headers: Resource<WithChildren<HeaderMap>>, ) -> Result<Resource<OutgoingResponse>>

Construct an outgoing-response, with a default status-code of 200. If a different status-code is needed, it must be set via the set-status-code method. Read more
Source§

fn body( &mut self, res: Resource<OutgoingResponse>, ) -> Result<Result<Resource<Arc<Mutex<OutgoingBody>>>, ()>>

Returns the resource corresponding to the outgoing Body for this Response. Read more
Source§

fn status_code(&mut self, res: Resource<OutgoingResponse>) -> Result<StatusCode>

Get the HTTP Status Code for the Response.
Source§

fn set_status_code( &mut self, res: Resource<OutgoingResponse>, status_code: StatusCode, ) -> Result<Result<(), ()>>

Set the HTTP Status Code for the Response. Fails if the status-code given is not a valid http status code.
Source§

fn headers( &mut self, res: Resource<OutgoingResponse>, ) -> Result<Resource<WithChildren<HeaderMap>>>

Get the headers associated with the Request. Read more
Source§

fn drop(&mut self, res: Resource<OutgoingResponse>) -> Result<()>

Source§

impl HostOutputStream for Ctx

Source§

fn check_write( &mut self, stream: Resource<OutputStream>, ) -> Result<Result<u64, StreamError>>

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

fn write( &mut self, stream: Resource<OutputStream>, contents: Vec<u8>, ) -> Result<Result<(), StreamError>>

Perform a write. This function never blocks. Read more
Source§

async fn blocking_write_and_flush( &mut self, stream: Resource<OutputStream>, contents: Vec<u8>, ) -> Result<Result<(), StreamError>>

Perform a write of up to 4096 bytes, and then flush the stream. Block until all of these operations are complete, or an error occurs. Read more
Source§

fn flush( &mut self, stream: Resource<OutputStream>, ) -> Result<Result<(), StreamError>>

Request to flush buffered output. This function never blocks. Read more
Source§

async fn blocking_flush( &mut self, stream: Resource<OutputStream>, ) -> Result<Result<(), StreamError>>

Request to flush buffered output, and block until flush completes and stream is ready for writing again.
Source§

fn subscribe( &mut self, stream: Resource<OutputStream>, ) -> Result<Resource<Pollable>>

Create a pollable which will resolve once the output-stream is ready for more writing, or an error has occurred. When this pollable is ready, check-write will return ok(n) with n>0, or an error. Read more
Source§

fn write_zeroes( &mut self, stream: Resource<OutputStream>, len: u64, ) -> Result<Result<(), StreamError>>

Write zeroes to a stream. Read more
Source§

async fn blocking_write_zeroes_and_flush( &mut self, stream: Resource<OutputStream>, len: u64, ) -> Result<Result<(), StreamError>>

Perform a write of up to 4096 zeroes, and then flush the stream. Block until all of these operations are complete, or an error occurs. Read more
Source§

fn splice( &mut self, stream: Resource<OutputStream>, src: Resource<InputStream>, len: u64, ) -> Result<Result<u64, StreamError>>

Read from one stream and write to another. Read more
Source§

async fn blocking_splice( &mut self, stream: Resource<OutputStream>, src: Resource<InputStream>, len: u64, ) -> Result<Result<u64, StreamError>>

Read from one stream and write to another, with blocking. Read more
Source§

fn drop(&mut self, stream: Resource<OutputStream>) -> Result<()>

Source§

impl HostPollable for Ctx

Source§

fn ready(&mut self, pollable: Resource<Pollable>) -> Result<bool>

Return the readiness of a pollable. This function never blocks. Read more
Source§

async fn block(&mut self, pollable: Resource<Pollable>) -> Result<()>

block returns immediately if the pollable is ready, and otherwise blocks until ready. Read more
Source§

fn drop(&mut self, pollable: Resource<Pollable>) -> Result<()>

Source§

impl HostRequestOptions for Ctx

Source§

fn new(&mut self) -> Result<Resource<WithChildren<RequestOptions>>>

Construct a default request-options value.
Source§

fn connect_timeout( &mut self, opts: Resource<WithChildren<RequestOptions>>, ) -> Result<Option<Duration>>

The timeout for the initial connect to the HTTP Server.
Source§

fn set_connect_timeout( &mut self, opts: Resource<WithChildren<RequestOptions>>, duration: Option<Duration>, ) -> Result<Result<(), ()>>

Set the timeout for the initial connect to the HTTP Server. An error return value indicates that this timeout is not supported.
Source§

fn first_byte_timeout( &mut self, opts: Resource<WithChildren<RequestOptions>>, ) -> Result<Option<Duration>>

The timeout for receiving the first byte of the Response body.
Source§

fn set_first_byte_timeout( &mut self, opts: Resource<WithChildren<RequestOptions>>, duration: Option<Duration>, ) -> Result<Result<(), ()>>

Set the timeout for receiving the first byte of the Response body. An error return value indicates that this timeout is not supported.
Source§

fn between_bytes_timeout( &mut self, opts: Resource<WithChildren<RequestOptions>>, ) -> Result<Option<Duration>>

The timeout for receiving subsequent chunks of bytes in the Response body stream.
Source§

fn set_between_bytes_timeout( &mut self, opts: Resource<WithChildren<RequestOptions>>, duration: Option<Duration>, ) -> Result<Result<(), ()>>

Set the timeout for receiving subsequent chunks of bytes in the Response body stream. An error return value indicates that this timeout is not supported.
Source§

fn drop(&mut self, opts: Resource<WithChildren<RequestOptions>>) -> Result<()>

Source§

impl HostResolveAddressStream for Ctx

Source§

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

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

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

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

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

Source§

impl HostResponseOutparam for Ctx

Source§

fn send_informational( &mut self, self_: Resource<ResponseOutparam>, status: u16, headers: Resource<WithChildren<HeaderMap>>, ) -> Result<Result<(), ErrorCode>>

Send an HTTP 1xx response. Read more
Source§

fn set( &mut self, param: Resource<ResponseOutparam>, response: Result<Resource<OutgoingResponse>, ErrorCode>, ) -> Result<()>

Set the value of the response-outparam to either send a response, or indicate an error. Read more
Source§

fn drop(&mut self, param: Resource<ResponseOutparam>) -> Result<()>

Source§

impl HostTcpSocket for Ctx

Source§

fn start_bind( &mut self, socket: Resource<TcpSocket>, _network: Resource<Network>, local_address: IpSocketAddress, ) -> Result<Result<(), ErrorCode>>

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

fn finish_bind( &mut self, socket: Resource<TcpSocket>, ) -> Result<Result<(), ErrorCode>>

Source§

fn start_connect( &mut self, socket: Resource<TcpSocket>, _network: Resource<Network>, remote_address: IpSocketAddress, ) -> Result<Result<(), ErrorCode>>

Connect to a remote endpoint. Read more
Source§

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

Source§

fn start_listen( &mut self, socket: Resource<TcpSocket>, ) -> Result<Result<(), ErrorCode>>

Start listening for new connections. Read more
Source§

fn finish_listen( &mut self, socket: Resource<TcpSocket>, ) -> Result<Result<(), ErrorCode>>

Source§

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

Accept a new client socket. Read more
Source§

fn subscribe( &mut self, socket: 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, socket: Resource<TcpSocket>, shutdown_type: ShutdownType, ) -> Result<Result<(), ErrorCode>>

Initiate a graceful shutdown. Read more
Source§

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

Get the bound local address. Read more
Source§

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

Get the remote address. Read more
Source§

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

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

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

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

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

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

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

Enables or disables keepalive. Read more
Source§

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

Source§

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

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, socket: Resource<TcpSocket>, value: Duration, ) -> Result<Result<(), ErrorCode>>

Source§

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

The time between keepalive packets. Read more
Source§

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

Source§

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

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

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

Source§

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

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

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

Source§

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

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

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

Source§

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

Source§

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

Source§

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

Source§

impl HostTerminalInput for Ctx

Source§

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

Source§

impl HostTerminalOutput for Ctx

Source§

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

Source§

impl HostUdpSocket for Ctx

Source§

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

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<Result<(), ErrorCode>>

Source§

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

Set up inbound & outbound communication channels, optionally to a specific peer. Read more
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 local_address( &mut self, socket: Resource<UdpSocket>, ) -> Result<Result<IpSocketAddress, ErrorCode>>

Get the current bound address. Read more
Source§

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

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

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

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

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

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

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

Source§

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

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

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

Source§

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

Source§

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

Source§

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

Source§

impl Host for Ctx

Source§

impl Host for Ctx

Source§

impl Host for Ctx

Source§

impl Host for Ctx

Source§

impl Host for Ctx

Source§

impl Host for Ctx

Auto Trait Implementations§

§

impl Freeze for Ctx

§

impl !RefUnwindSafe for Ctx

§

impl Send for Ctx

§

impl !Sync for Ctx

§

impl Unpin for Ctx

§

impl !UnwindSafe for Ctx

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.

Source§

impl<T> GetSetFdFlags for T

Source§

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

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

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
Source§

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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

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

Initializes a with the given initializer. Read more
Source§

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

Dereferences the given pointer. Read more
Source§

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

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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.
Source§

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

Source§

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
Source§

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