Skip to main content

GCSerialInterface

Struct GCSerialInterface 

#[repr(transparent)]
pub struct GCSerialInterface(sGCSerialInterface);
Expand description

Zero-cost abstraction over Serial interface configuration from C ABI.

This struct wraps the C ABI struct and provides safe Rust accessors.

Tuple Fields§

§0: sGCSerialInterface

Implementations§

§

impl GCSerialInterface

pub fn interface<'a>(&'a self) -> Cow<'a, str>

Get the OS interface path (e.g., “/dev/ttyS0”, “/dev/ttyM0”)

Returns the interface path as a string slice, or None if the C string is invalid.

pub fn baud_rate(&self) -> u32

Get the baud rate (e.g., 9600, 115200)

pub fn parity(&self) -> Result<Parity, GCPluginABIError>

Get the parity setting

pub fn stop_bits(&self) -> Result<StopBits, GCPluginABIError>

Get the number of stop bits

pub fn data_bits(&self) -> Result<DataBits, GCPluginABIError>

Get the number of data bits

Trait Implementations§

§

impl Debug for GCSerialInterface

§

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

Formats the value using the given formatter. Read more
§

impl GCAbiConversion for GCSerialInterface

§

type CType = sGCSerialInterface

§

fn from_c(c_type: Self::CType) -> Self

Convert from the C type to the Rust type
§

fn into_c(self) -> Self::CType

Convert from the Rust type to the C type
§

fn ref_c(&self) -> &Self::CType

Get a reference to the C type
§

fn from_c_ref(c_type: &Self::CType) -> &Self

Get a reference to the converted type
§

unsafe fn from_c_ptr(ptr: *const Self::CType) -> &'static Self

Get a mutable reference to the C type Read more
§

unsafe fn as_ptr(&self) -> *const Self::CType

Get a immutable reference to the C type Read more
§

unsafe fn as_mut_ptr(&mut self) -> *mut Self::CType

Get a mutable reference to the C type Read more

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