Skip to main content

Pipe

Struct Pipe 

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

A CFE Software Bus pipe.

When dropped, it automatically cleans up the underlying CFE resource.

Implementations§

Source§

impl Pipe

Source

pub fn new(name: &str, depth: u16) -> Result<Self>

Creates a new software bus pipe.

§Arguments
  • name - A unique string to identify the pipe.
  • depth - The maximum number of messages the pipe can hold.
Source

pub fn subscribe_ex(&self, msg_id: MsgId, qos: Qos, msg_lim: u16) -> Result<()>

Subscribes this pipe to messages with the specified MsgId and extended options.

§Arguments
  • msg_id: The message ID of the message to be subscribed to.
  • qos: The requested Quality of Service.
  • msg_lim: The maximum number of messages with this Message ID to allow in this pipe at the same time.
Source

pub fn subscribe(&self, msg_id: MsgId) -> Result<()>

Subscribes this pipe to messages with the specified MsgId.

Subscriptions are added to the head of an internal linked list, so messages are delivered in LIFO order (last subscriber receives first).

§Arguments
  • msg_id: The message ID of the message to be subscribed to.
Source

pub fn unsubscribe(&self, msg_id: MsgId) -> Result<()>

Unsubscribes this pipe from messages with the specified MsgId.

Source

pub fn unsubscribe_local(&self, msg_id: MsgId) -> Result<()>

Unsubscribes this pipe from messages, keeping the request local to this CPU.

This is typically only used by a Software Bus Network (SBN) application.

Source

pub fn timed_recv(&mut self, buf: &mut [u8], timeout: Timeout) -> Result<usize>

Receives a message from this pipe, copying it into a user-provided buffer.

This method receives a message from the CFE-managed internal buffer and safely copies it into the provided buf.

§Arguments
  • timeout: Timeout in milliseconds. Use sb::pipe::PEND_FOREVER to block indefinitely or sb::pipe::POLL for a non-blocking check.
  • buffer - A mutable byte slice to copy the message into.
§Returns

A MessageRef containing the message data, tied to the lifetime of buffer.

§Errors

Returns Error::SbTimeOut or Error::SbNoMessage if no message is received within the timeout. Returns Error::SbBadArgument if the timeout value is invalid. Returns Error::OsErrInvalidSize if the received message is larger than buf.

Source

pub fn set_opts(&self, opts: PipeOptions) -> Result<()>

Sets options for the pipe, see PipeOptions for the available options.

Source

pub fn get_opts(&self) -> Result<PipeOptions>

Gets the current options for the pipe, see PipeOptions for the available options.

Source

pub fn id(&self) -> PipeId

Returns the underlying PipeId for this pipe.

Source

pub fn name(&self) -> Result<String<{ _ }>>

Gets the registered name of this pipe.

Source

pub fn get_id_by_name(name: &str) -> Result<PipeId>

Finds the PipeId for a pipe with the given name.

Source

pub fn subscribe_local(&self, msg_id: MsgId, msg_lim: u16) -> Result<()>

Subscribes this pipe to messages, keeping the request local to this CPU.

This is typically only used by a Software Bus Network (SBN) application.

§Arguments
  • msg_id: The message ID of the message to be subscribed to.
  • msg_lim: The maximum number of messages with this Message ID to allow in this pipe at the same time.
Source§

impl Pipe

Source

pub fn recv<'a>( &'a mut self, buf: &'a mut [u8], ) -> impl Future<Output = Result<usize>> + use<'a>

Asynchronously receives a single datagram message on the socket.

Trait Implementations§

Source§

impl Debug for Pipe

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Drop for Pipe

Source§

fn drop(&mut self)

Automatically deletes the CFE software bus pipe when the Pipe object goes out of scope.

Auto Trait Implementations§

§

impl Freeze for Pipe

§

impl RefUnwindSafe for Pipe

§

impl Send for Pipe

§

impl Sync for Pipe

§

impl Unpin for Pipe

§

impl UnsafeUnpin for Pipe

§

impl UnwindSafe for Pipe

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.