Skip to main content

PlainCdr2BeKeyHolder

Struct PlainCdr2BeKeyHolder 

Source
pub struct PlainCdr2BeKeyHolder { /* private fields */ }
Expand description

Convenience-Builder fuer einen PLAIN_CDR2-BE-KeyHolder-Stream.

PLAIN_CDR2 unterscheidet sich von XCDR1 in Alignment-Regel: maximales Alignment ist 4 Byte (XTypes 1.3 §7.4.2.5.4) — i64/f64 wird nicht 8-aligned. Dieser Builder kapselt die Alignment-Logik und vermeidet Drift mit dem zerodds-cdr-Buffer-Writer (der XCDR2-LE-default ist).

Member werden in der Reihenfolge der member_id aufsteigend hinzugefuegt (Spec-Pflicht §7.6.8.3.1.b).

Implementations§

Source§

impl PlainCdr2BeKeyHolder

Source

pub fn new() -> PlainCdr2BeKeyHolder

Leerer Builder.

Source

pub fn len(&self) -> usize

Aktuelle Stream-Laenge (typisch == max_size, wenn alle Member fest).

Source

pub fn is_empty(&self) -> bool

true wenn keine Bytes geschrieben.

Source

pub fn into_bytes(self) -> Vec<u8>

Gibt die fertigen Bytes zurueck.

Source

pub fn as_bytes(&self) -> &[u8]

Zugriff auf die internen Bytes ohne Konsumieren.

Source

pub fn write_u8(&mut self, v: u8)

Schreibt einen u8.

Source

pub fn write_i8(&mut self, v: i8)

Schreibt einen i8.

Source

pub fn write_u16(&mut self, v: u16)

Schreibt einen u16 in BE.

Source

pub fn write_i16(&mut self, v: i16)

Schreibt einen i16 in BE.

Source

pub fn write_u32(&mut self, v: u32)

Schreibt einen u32 in BE.

Source

pub fn write_i32(&mut self, v: i32)

Schreibt einen i32 in BE.

Source

pub fn write_u64(&mut self, v: u64)

Schreibt einen u64 in BE — alignment 4, NICHT 8 (PLAIN_CDR2).

Source

pub fn write_i64(&mut self, v: i64)

Schreibt einen i64 in BE — alignment 4.

Source

pub fn write_f32(&mut self, v: f32)

Schreibt einen f32 in BE.

Source

pub fn write_f64(&mut self, v: f64)

Schreibt einen f64 in BE — alignment 4.

Source

pub fn write_string(&mut self, s: &str)

Schreibt eine bounded String in CDR-Form (4-byte length BE + utf8-Bytes inkl. terminating NUL). Caller stellt sicher, dass die Laenge die statische Bound nicht ueberschreitet (sonst kollidiert das mit key_holder_max_size).

Source

pub fn write_bytes(&mut self, b: &[u8])

Schreibt einen rohen byte-Slice (z.B. fuer Octet-Arrays).

Trait Implementations§

Source§

impl Debug for PlainCdr2BeKeyHolder

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Default for PlainCdr2BeKeyHolder

Source§

fn default() -> PlainCdr2BeKeyHolder

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.