Skip to main content

BufferReader

Struct BufferReader 

Source
pub struct BufferReader<'a> { /* private fields */ }
Expand description

Lese-Buffer mit Alignment-Tracking.

Implementations§

Source§

impl<'a> BufferReader<'a>

Source

pub fn new(bytes: &'a [u8], endianness: Endianness) -> Self

Konstruiert einen Reader ueber den gegebenen Slice.

Source

pub fn endianness(&self) -> Endianness

Aktuelle Endianness.

Source

pub fn position(&self) -> usize

Aktuelle Position im Stream.

Source

pub fn remaining(&self) -> usize

Verbleibende Bytes bis zum Ende.

Source

pub fn align(&mut self, alignment: usize) -> Result<(), DecodeError>

Skipt Padding bis zur naechsten alignment-Boundary.

§Errors

UnexpectedEof, wenn nicht genug Bytes fuer das Padding da sind.

Source

pub fn read_bytes(&mut self, n: usize) -> Result<&'a [u8], DecodeError>

Liest exakt n Bytes als Slice (ohne Alignment).

§Errors

UnexpectedEof.

Source

pub fn read_u8(&mut self) -> Result<u8, DecodeError>

Liest ein einzelnes Byte.

§Errors

UnexpectedEof.

Source

pub fn read_u16(&mut self) -> Result<u16, DecodeError>

Aligned + liest u16.

§Errors

UnexpectedEof.

Source

pub fn read_u32(&mut self) -> Result<u32, DecodeError>

Aligned + liest u32.

§Errors

UnexpectedEof.

Source

pub fn read_u64(&mut self) -> Result<u64, DecodeError>

Aligned + liest u64.

§Errors

UnexpectedEof.

Source

pub fn read_string(&mut self) -> Result<String, DecodeError>

Liest einen CDR-String (§9.3.2.7): 4-byte length (inkl. Null- Terminator) + UTF-8 Bytes + 1 Null-Byte. Gibt den String ohne Terminator zurueck.

§Errors

UnexpectedEof bei zu kurzen Daten; InvalidData bei nicht-UTF-8 Bytes, fehlendem Null-Terminator oder length == 0.

Trait Implementations§

Source§

impl<'a> Clone for BufferReader<'a>

Source§

fn clone(&self) -> BufferReader<'a>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a> Debug for BufferReader<'a>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for BufferReader<'a>

§

impl<'a> RefUnwindSafe for BufferReader<'a>

§

impl<'a> Send for BufferReader<'a>

§

impl<'a> Sync for BufferReader<'a>

§

impl<'a> Unpin for BufferReader<'a>

§

impl<'a> UnsafeUnpin for BufferReader<'a>

§

impl<'a> UnwindSafe for BufferReader<'a>

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.