Struct Reader

Source
pub struct Reader<T, C>
where T: Read, C: CapabilitiesRef,
{ pub stream: T, pub capabilities: C, }
Expand description

The BGPReader can read BGP messages from a BGP-formatted stream.

Fields§

§stream: T

The stream from which BGP messages will be read.

§capabilities: C

Capability parameters that distinguish how BGP messages should be parsed.

Implementations§

Source§

impl<T, C> Reader<T, C>
where T: Read, C: CapabilitiesRef,

Source

pub fn read(&mut self) -> Result<(Header, Message), Error>

Reads the next BGP message in the stream.

§Panics

This function does not panic.

§Errors

Any IO error will be returned while reading from the stream. If an ill-formatted stream provided behavior will be undefined.

§Safety

This function does not make use of unsafe code.

Source§

impl<T> Reader<T, Capabilities>
where T: Read,

Source

pub fn new(stream: T) -> Self
where T: Read,

Constructs a BGPReader with default parameters.

§Panics

This function does not panic.

§Errors

Any IO error will be returned while reading from the stream. If an ill-formatted stream provided behavior will be undefined.

§Safety

This function does not make use of unsafe code.

Auto Trait Implementations§

§

impl<T, C> Freeze for Reader<T, C>
where T: Freeze, C: Freeze,

§

impl<T, C> RefUnwindSafe for Reader<T, C>

§

impl<T, C> Send for Reader<T, C>
where T: Send, C: Send,

§

impl<T, C> Sync for Reader<T, C>
where T: Sync, C: Sync,

§

impl<T, C> Unpin for Reader<T, C>
where T: Unpin, C: Unpin,

§

impl<T, C> UnwindSafe for Reader<T, C>
where T: UnwindSafe, C: UnwindSafe,

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.