pub struct Fixed {
pub octets: u32,
pub misplaced: &'static str,
pub wrong_length: &'static str,
}Expand description
A fixed-size primitive type decode_ctx_fixed reads: how many contents
octets it has, and the labels of its two refusals.
The consts cover the types the shared readers take. A codec with another one builds its own, its labels in the same form:
use bacnet_encoding::constructed::tagged::{decode_ctx_fixed, Fixed};
const MASK: Fixed = Fixed {
octets: 4,
misplaced: "expected context tag [{}] broadcast mask",
wrong_length: "[{}] broadcast mask has {} contents octets, expected 4",
};
let refused = decode_ctx_fixed(&[0x1B, 255, 255, 0], 0, 1, MASK, "BDT entry").unwrap_err();
assert_eq!(
refused.to_string(),
"decoding error at offset 0: BDT entry: [1] broadcast mask has 3 contents octets, expected 4"
);Fields§
§octets: u32The contents octets every value of the type has.
misplaced: &'static strThe label when another tag stands where the member’s is due; its {}
is the member’s tag number.
wrong_length: &'static strThe label when the member’s header announces another length; its two
{} are the tag number and the length announced.
Implementations§
Source§impl Fixed
impl Fixed
Sourcepub const OBJECT_IDENTIFIER: Self
pub const OBJECT_IDENTIFIER: Self
An object identifier: four octets.
Trait Implementations§
impl Copy for Fixed
impl Eq for Fixed
impl StructuralPartialEq for Fixed
Auto Trait Implementations§
impl Freeze for Fixed
impl RefUnwindSafe for Fixed
impl Send for Fixed
impl Sync for Fixed
impl Unpin for Fixed
impl UnsafeUnpin for Fixed
impl UnwindSafe for Fixed
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