Struct skyline_web::WebSession
source · pub struct WebSession(_);
Implementations
sourceimpl WebSession
impl WebSession
sourcepub fn try_send(&self, message: &str) -> bool
pub fn try_send(&self, message: &str) -> bool
Attempts to send a message, returning true if it succeeds
sourcepub fn recv(&self) -> String
pub fn recv(&self) -> String
Blocks until a message is recieved
Up to 4 KiB in size, for larger or more efficient sizes use recv_max
sourcepub fn recv_max(&self, max_size: usize) -> String
pub fn recv_max(&self, max_size: usize) -> String
Blocks until a message is recieved, up to max_size
bytes
sourcepub fn try_recv(&self) -> Option<String>
pub fn try_recv(&self) -> Option<String>
Attempts to recieve a message without blocking
Up to 4 KiB in size, for larger or more efficient sizes use try_recv_max
sourcepub fn try_recv_max(&self, max_size: usize) -> Option<String>
pub fn try_recv_max(&self, max_size: usize) -> Option<String>
Attempts to recieve a message without blocking, up to max_size
bytes
sourcepub fn wait_for_exit(&self) -> PageResult
pub fn wait_for_exit(&self) -> PageResult
Wait until the page has been exited
pub fn exit(&self)
sourceimpl WebSession
impl WebSession
sourcepub fn send_json<T: Serialize>(&self, obj: &T)
pub fn send_json<T: Serialize>(&self, obj: &T)
Send a type as a JSON value, blocking until it sends
sourcepub fn try_send_json<T: Serialize>(&self, obj: &T) -> bool
pub fn try_send_json<T: Serialize>(&self, obj: &T) -> bool
Attempt to send a type as a JSON value, returning false if it doesn’t succeed
sourcepub fn recv_json<T: DeserializeOwned>(&self) -> Result<T>
pub fn recv_json<T: DeserializeOwned>(&self) -> Result<T>
Receive a given type as a JSON message, blocking until one is ready
sourcepub fn try_recv_json<T: DeserializeOwned>(&self) -> Option<Result<T>>
pub fn try_recv_json<T: DeserializeOwned>(&self) -> Option<Result<T>>
Receive a given type as a JSON message, returning None if a message is not ready
sourcepub fn recv_json_max<T: DeserializeOwned>(&self, max_size: usize) -> Result<T>
pub fn recv_json_max<T: DeserializeOwned>(&self, max_size: usize) -> Result<T>
Receive a given type as a JSON message, blocking until one is ready, setting a custom max payload size.
sourcepub fn try_recv_json_max<T: DeserializeOwned>(
&self,
max_size: usize
) -> Option<Result<T>>
pub fn try_recv_json_max<T: DeserializeOwned>(
&self,
max_size: usize
) -> Option<Result<T>>
Receive a given type as a JSON message, returning None if a message is not ready, with a
max message size of max_size