pub struct IdBuilder { /* private fields */ }Implementations§
Source§impl IdBuilder
impl IdBuilder
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new IdBuilder
A source address and PGN must be provided. If a PDU1 PF is selected, a destination address must also be provided.
Sourcepub fn pgn(self, pgn: Pgn) -> Self
pub fn pgn(self, pgn: Pgn) -> Self
Parameter group number.
Must be set or .build() will panic.
Examples found in repository?
examples/identifiers.rs (line 6)
3pub fn main() {
4 let id_builder = Id::builder()
5 .sa(0x55)
6 .pgn(Pgn::ProprietaryA)
7 .da(0x00)
8 .build()
9 .unwrap();
10 println!("Built id: {:x}", id_builder.as_raw());
11
12 let id_from_raw = Id::new(418316373);
13 println!(
14 "Id from raw, pgn: {:?}, sa: {}, da: {:?}",
15 id_from_raw.pgn(),
16 id_from_raw.sa(),
17 id_from_raw.da(),
18 );
19}Sourcepub fn sa(self, sa: u8) -> Self
pub fn sa(self, sa: u8) -> Self
Source address.
Examples found in repository?
examples/identifiers.rs (line 5)
3pub fn main() {
4 let id_builder = Id::builder()
5 .sa(0x55)
6 .pgn(Pgn::ProprietaryA)
7 .da(0x00)
8 .build()
9 .unwrap();
10 println!("Built id: {:x}", id_builder.as_raw());
11
12 let id_from_raw = Id::new(418316373);
13 println!(
14 "Id from raw, pgn: {:?}, sa: {}, da: {:?}",
15 id_from_raw.pgn(),
16 id_from_raw.sa(),
17 id_from_raw.da(),
18 );
19}Sourcepub fn da(self, da: u8) -> Self
pub fn da(self, da: u8) -> Self
Destination address.
Required for PDU1 messages or .build() will panic.
Examples found in repository?
examples/identifiers.rs (line 7)
3pub fn main() {
4 let id_builder = Id::builder()
5 .sa(0x55)
6 .pgn(Pgn::ProprietaryA)
7 .da(0x00)
8 .build()
9 .unwrap();
10 println!("Built id: {:x}", id_builder.as_raw());
11
12 let id_from_raw = Id::new(418316373);
13 println!(
14 "Id from raw, pgn: {:?}, sa: {}, da: {:?}",
15 id_from_raw.pgn(),
16 id_from_raw.sa(),
17 id_from_raw.da(),
18 );
19}Sourcepub fn build(self) -> Option<Id>
pub fn build(self) -> Option<Id>
Examples found in repository?
examples/identifiers.rs (line 8)
3pub fn main() {
4 let id_builder = Id::builder()
5 .sa(0x55)
6 .pgn(Pgn::ProprietaryA)
7 .da(0x00)
8 .build()
9 .unwrap();
10 println!("Built id: {:x}", id_builder.as_raw());
11
12 let id_from_raw = Id::new(418316373);
13 println!(
14 "Id from raw, pgn: {:?}, sa: {}, da: {:?}",
15 id_from_raw.pgn(),
16 id_from_raw.sa(),
17 id_from_raw.da(),
18 );
19}Trait Implementations§
impl Copy for IdBuilder
Auto Trait Implementations§
impl Freeze for IdBuilder
impl RefUnwindSafe for IdBuilder
impl Send for IdBuilder
impl Sync for IdBuilder
impl Unpin for IdBuilder
impl UnwindSafe for IdBuilder
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