[][src]Struct linuxcnc_hal::HalComponentBuilder

pub struct HalComponentBuilder { /* fields omitted */ }

HAL component builder

Create a new HAL component with HalComponentBuilder::new. Use the builder to register a component with LinuxCNC. Once created, pins can be registered to the component. Finally, call builder.ready() to consume the builder and create a HalComponent ready for use in the component main loop.

Methods

impl HalComponentBuilder[src]

pub fn new(name: &'static str) -> Result<Self, ComponentInitError>[src]

Create a new HAL component builder and begin initialisation

Safety

This calls hal_init internally, which may panic or leak memory.

Errors

This component will error if the component name is longer than HAL_NAME_LEN, the name cannot be converted to a valid CString or the call to hal_init returns an invalid ID.

pub fn register_input_pin<P>(
    &mut self,
    pin_name: &'static str
) -> Result<InputPin<P>, PinRegisterError> where
    P: HalPin + 'static, 
[src]

Register an input pin with this component

The pin name will be prefixed with the component name

pub fn register_output_pin<P>(
    &mut self,
    pin_name: &'static str
) -> Result<OutputPin<P>, PinRegisterError> where
    P: HalPin + 'static, 
[src]

Register an output pin with this component

The pin name will be prefixed with the component name

pub fn ready(self) -> Result<HalComponent, ComponentReadyError>[src]

Consume the builder and signal that the component is ready

This method is called after any pins are registered and consumes the builder into a HalComponent.

Safety

This method calls the unsafe hal_ready method internally.

pub fn id(&self) -> i32[src]

Get the HAL-assigned ID for this component

pub fn name(&self) -> &str[src]

Get the component name

Trait Implementations

impl Debug for HalComponentBuilder[src]

impl PartialEq<HalComponentBuilder> for HalComponentBuilder[src]

impl StructuralPartialEq for HalComponentBuilder[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.