Skip to content

Commit

Permalink
Add doc comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
qwandor committed Nov 27, 2024
1 parent d34d941 commit 4fe7e97
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/transport/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,8 @@ impl From<u8> for DeviceType {
}
}

/// Wrapper for Transport::read_config_space with an extra dummy parameter to force the correct type
/// to be inferred.
#[inline(always)]
pub(crate) fn read_help<T: Transport, V: FromBytes>(
transport: &T,
Expand All @@ -241,6 +243,8 @@ pub(crate) fn read_help<T: Transport, V: FromBytes>(
transport.read_config_space(offset)
}

/// Wrapper for Transport::write_config_space with an extra dummy parameter to force the correct
/// type to be inferred.
#[inline(always)]
pub(crate) fn write_help<T: Transport, V: Immutable + IntoBytes>(
transport: &mut T,
Expand All @@ -251,6 +255,7 @@ pub(crate) fn write_help<T: Transport, V: Immutable + IntoBytes>(
transport.write_config_space(offset, value)
}

/// Reads the given field of the given struct from the device config space via the given transport.
macro_rules! read_config {
($transport:expr, $struct:ty, $field:ident) => {{
let dummy_struct: Option<$struct> = None;
Expand All @@ -259,6 +264,7 @@ macro_rules! read_config {
}};
}

/// Writes the given field of the given struct from the device config space via the given transport.
macro_rules! write_config {
($transport:expr, $struct:ty, $field:ident, $value:expr) => {{
let dummy_struct: Option<$struct> = None;
Expand Down

0 comments on commit 4fe7e97

Please sign in to comment.