pub struct GpioConfig {
pub pins: Vec<PinConfig>,
pub config: SysConfig,
}
Fields§
§pins: Vec<PinConfig>
§config: SysConfig
Implementations§
Source§impl GpioConfig
impl GpioConfig
Sourcepub fn load(configs: &[String]) -> Result<GpioConfig, Error>
pub fn load(configs: &[String]) -> Result<GpioConfig, Error>
Load a GPIO Config from the system
This function will load the GPIO configuration from standard system
locations as well as from the additional configs passed in via the
configs
parameter. Each parameter is expected to be a path to a
config file in disk.
Under the covers, this function will attempt to discover configuration files in the following standard locations in order:
/etc/gpio.toml
/etc/gpio.d/*.toml
configs
(parameter)
Each config file found in these locations will be loaded and then they
will be pulled together to form a unified configuration via the
combine
method.
Sourcepub fn from_file<P: AsRef<Path>>(path: P) -> Result<GpioConfig, Error>
pub fn from_file<P: AsRef<Path>>(path: P) -> Result<GpioConfig, Error>
Load a GPIO config from the specified path
Sourcepub fn get_pin(&self, name: &str) -> Option<&PinConfig>
pub fn get_pin(&self, name: &str) -> Option<&PinConfig>
Get the pin with the provided name if present in this configuration
Sourcepub fn get_symlink_root(&self) -> &str
pub fn get_symlink_root(&self) -> &str
Get the symlink root specified in the config (or the default)
Trait Implementations§
Source§impl Clone for GpioConfig
impl Clone for GpioConfig
Source§fn clone(&self) -> GpioConfig
fn clone(&self) -> GpioConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for GpioConfig
impl Debug for GpioConfig
Source§impl Default for GpioConfig
impl Default for GpioConfig
Source§fn default() -> GpioConfig
fn default() -> GpioConfig
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for GpioConfig
impl<'de> Deserialize<'de> for GpioConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for GpioConfig
impl RefUnwindSafe for GpioConfig
impl Send for GpioConfig
impl Sync for GpioConfig
impl Unpin for GpioConfig
impl UnwindSafe for GpioConfig
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