Skip to main content

WebSession

Struct WebSession 

Source
pub struct WebSession(/* private fields */);

Implementations§

Source§

impl WebSession

Source

pub fn send(&self, message: &str)

Sends a message, blocking until it succeeds

Source

pub fn try_send(&self, message: &str) -> bool

Attempts to send a message, returning true if it succeeds

Source

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

Source

pub fn recv_max(&self, max_size: usize) -> String

Blocks until a message is recieved, up to max_size bytes

Source

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

Source

pub fn try_recv_max(&self, max_size: usize) -> Option<String>

Attempts to recieve a message without blocking, up to max_size bytes

Source

pub fn show(&self)

Show a previously hidden web session

Source

pub fn wait_for_exit(&self) -> PageResult

Wait until the page has been exited

Source

pub fn exit(&self)

Source§

impl WebSession

Source

pub fn send_json<T: Serialize>(&self, obj: &T)

Send a type as a JSON value, blocking until it sends

Source

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

Source

pub fn recv_json<T: DeserializeOwned>(&self) -> Result<T>

Receive a given type as a JSON message, blocking until one is ready

Source

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

Source

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.

Source

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

Auto Trait Implementations§

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, 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.