Skip to main content

SessionHandle

Struct SessionHandle 

Source
pub struct SessionHandle { /* private fields */ }
Expand description

FFI wrapper for Session.

Implementations§

Source§

impl SessionHandle

Source

pub fn init( their_ephemeral_pubkey_hex: String, our_ephemeral_privkey_hex: String, is_initiator: bool, shared_secret_hex: String, name: Option<String>, ) -> Result<Arc<Self>, NdrError>

Initialize a new session.

Source

pub fn from_state_json(state_json: String) -> Result<Arc<Self>, NdrError>

Restore a session from serialized state JSON.

Source

pub fn state_json(&self) -> Result<String, NdrError>

Serialize the session state to JSON.

Source

pub fn can_send(&self) -> bool

Check if the session is ready to send messages.

Source

pub fn send_text(&self, text: String) -> Result<SendResult, NdrError>

Send a text message.

Source

pub fn decrypt_event( &self, outer_event_json: String, ) -> Result<DecryptResult, NdrError>

Decrypt a received event.

Source

pub fn is_dr_message(&self, event_json: String) -> bool

Check if an event is a double-ratchet message.

Trait Implementations§

Source§

impl<UT> LiftRef<UT> for SessionHandle

Source§

impl<UT> LowerError<UT> for SessionHandle

Source§

fn lower_error(obj: Self) -> RustBuffer

Lower this value for scaffolding function return Read more
Source§

impl<UT> LowerReturn<UT> for SessionHandle

Source§

type ReturnType = <Arc<SessionHandle> as LowerReturn<UniFfiTag>>::ReturnType

The type that should be returned by scaffolding functions for this type. Read more
Source§

fn lower_return(obj: Self) -> Result<Self::ReturnType, RustCallError>

Lower the return value from an scaffolding call Read more
Source§

fn handle_failed_lift( error: LiftArgsError, ) -> Result<Self::ReturnType, RustCallError>

Lower the return value for failed argument lifts Read more
Source§

impl<UT> TypeId<UT> for SessionHandle

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, UT> HandleAlloc<UT> for T
where T: Send + Sync,

Source§

fn new_handle(value: Arc<T>) -> Handle

Create a new handle for an Arc value Read more
Source§

unsafe fn clone_handle(handle: Handle) -> Handle

Clone a handle Read more
Source§

unsafe fn consume_handle(handle: Handle) -> Arc<T>

Consume a handle, getting back the initial Arc<> Read more
Source§

unsafe fn get_arc(handle: Handle) -> Arc<Self>

Get a clone of the Arc<> using a “borrowed” handle. 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> 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