Struct GenericPortData

Source
#[repr(C)]
pub struct GenericPortData<T: PortData> { pub inner: T, pub owner_pid: u32, pub active: bool, }
Expand description

Generic port data wrapper with standard functionality

Fields§

§inner: T§owner_pid: u32§active: bool

Implementations§

Source§

impl<T: PortData> GenericPortData<T>

Source

pub fn new(inner: T) -> Self

Source

pub fn set_owner(&mut self, pid: u32)

Source

pub fn deactivate(&mut self)

Source

pub fn get_inner(&self) -> &T

Source

pub fn get_inner_mut(&mut self) -> &mut T

Trait Implementations§

Source§

impl<T: PortData> PlatformData for GenericPortData<T>

Source§

fn cleanup(&mut self)

Called when the platform data is being cleaned up
Source§

unsafe fn store_in_context(self, ctx: &mut Context)

Store this data in a context
Source§

unsafe fn from_context(ctx: &Context) -> Option<&Self>

Retrieve this data from a context
Source§

unsafe fn from_context_mut(ctx: &mut Context) -> Option<&mut Self>

Retrieve this data mutably from a context
Source§

unsafe fn take_from_context(ctx: &mut Context) -> Option<Self>

Take ownership of this data from a context
Source§

impl<T: PortData> PortData for GenericPortData<T>

Source§

fn handle_message(&mut self, message: &Message) -> PortResult

Called when the port receives a message
Source§

fn get_owner_pid(&self) -> Option<u32>

Get the owner PID for this port (if any)
Source§

fn set_owner_pid(&mut self, pid: u32)

Set the owner PID for this port
Source§

fn is_active(&self) -> bool

Check if the port is active
Source§

fn set_active(&mut self, active: bool)

Activate/deactivate the port

Auto Trait Implementations§

§

impl<T> Freeze for GenericPortData<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for GenericPortData<T>
where T: RefUnwindSafe,

§

impl<T> Send for GenericPortData<T>
where T: Send,

§

impl<T> Sync for GenericPortData<T>
where T: Sync,

§

impl<T> Unpin for GenericPortData<T>
where T: Unpin,

§

impl<T> UnwindSafe for GenericPortData<T>
where T: UnwindSafe,

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 = 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.