pub struct MllpFormatter;Implementations§
Source§impl MllpFormatter
impl MllpFormatter
pub fn encode(payload: &[u8]) -> Vec<u8> ⓘ
Sourcepub fn decode(framed: &[u8]) -> Result<&[u8], OperationOutcomeError>
pub fn decode(framed: &[u8]) -> Result<&[u8], OperationOutcomeError>
Decodes an MLLP-framed message and returns the enclosed payload.
§Errors
Returns an [OperationOutcomeError] if framed is not a valid MLLP frame,
that is, if it is shorter than the minimum frame length or does not start
with <SB> and end with <EB><CR>.
pub fn ack() -> [u8; 4]
pub fn nak() -> [u8; 4]
pub fn is_ack(bytes: &[u8]) -> bool
pub fn is_nak(bytes: &[u8]) -> bool
Sourcepub fn read_frame<R: Read>(
reader: &mut R,
) -> Result<Vec<u8>, OperationOutcomeError>
pub fn read_frame<R: Read>( reader: &mut R, ) -> Result<Vec<u8>, OperationOutcomeError>
Reads a single MLLP frame from reader, returning the raw framed bytes,
including the START_BLOCK, END_BLOCK, and CARRIAGE_RETURN
delimiters.
§Errors
Returns an [OperationOutcomeError] if:
- the stream ends before a complete MLLP frame is received,
- the frame does not begin with
START_BLOCK, or - an I/O error occurs while reading from the stream.
Auto Trait Implementations§
impl Freeze for MllpFormatter
impl RefUnwindSafe for MllpFormatter
impl Send for MllpFormatter
impl Sync for MllpFormatter
impl Unpin for MllpFormatter
impl UnsafeUnpin for MllpFormatter
impl UnwindSafe for MllpFormatter
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> ErasedDestructor for Twhere
T: 'static,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more