svd-generator 0.4.3

Converts device information from flattened device tree into an SVD description
Documentation
use alloc::string::String;

/// Convenience alias for [`Result`](core::result::Result) type for the library.
pub type Result<T> = core::result::Result<T, Error>;

/// Represents error types for the library.
#[derive(Clone, Debug, Eq, PartialEq)]
pub enum Error {
    Io(String),
    DeviceTree(String),
    Svd(String),
    InvalidBitRange,
}

impl From<device_tree::Error> for Error {
    fn from(err: device_tree::Error) -> Self {
        Self::DeviceTree(format!("{err:?}"))
    }
}

#[cfg(feature = "std")]
impl From<std::io::Error> for Error {
    fn from(err: std::io::Error) -> Self {
        Self::Io(format!("{err}"))
    }
}

#[cfg(feature = "std")]
impl From<svd::SvdError> for Error {
    fn from(err: svd::SvdError) -> Self {
        Self::Svd(format!("{err}"))
    }
}

#[cfg(feature = "std")]
impl From<svd_encoder::EncodeError> for Error {
    fn from(err: svd_encoder::EncodeError) -> Error {
        Self::Svd(format!("{err}"))
    }
}