pub struct SessionEndpoint {
pub remaining: SType,
/* private fields */
}Expand description
A session channel endpoint, consuming the session type as it is used.
Note: In Rust we cannot enforce linearity at the type level without a linear type system; this struct instead tracks usage dynamically.
Fields§
§remaining: STypeThe remaining session type (what is yet to be done).
Implementations§
Source§impl SessionEndpoint
impl SessionEndpoint
Sourcepub fn new(stype: SType) -> Self
pub fn new(stype: SType) -> Self
Create a new session endpoint with the given initial session type.
Sourcepub fn send(&mut self, msg: Message) -> Result<(), String>
pub fn send(&mut self, msg: Message) -> Result<(), String>
Send a message, advancing the session type.
Sourcepub fn recv(&mut self) -> Result<Message, String>
pub fn recv(&mut self) -> Result<Message, String>
Receive a message from the buffer, advancing the session type.
Sourcepub fn select_left(&mut self) -> Result<(), String>
pub fn select_left(&mut self) -> Result<(), String>
Select the left branch of an internal choice.
Sourcepub fn select_right(&mut self) -> Result<(), String>
pub fn select_right(&mut self) -> Result<(), String>
Select the right branch of an internal choice.
Sourcepub fn is_complete(&self) -> bool
pub fn is_complete(&self) -> bool
Check if the session is complete.
Auto Trait Implementations§
impl Freeze for SessionEndpoint
impl RefUnwindSafe for SessionEndpoint
impl Send for SessionEndpoint
impl Sync for SessionEndpoint
impl Unpin for SessionEndpoint
impl UnsafeUnpin for SessionEndpoint
impl UnwindSafe for SessionEndpoint
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more