pub struct ChannelOut<'a, C>where
C: ChannelCompressor,{
pub id: [u8; 16],
pub config: &'a RollupConfig,
pub rlp_length: u64,
pub closed: bool,
pub frame_number: u16,
pub compressor: C,
}
Available on crate feature
protocol
only.Expand description
ChannelOut constructs a channel from compressed, encoded batch data.
Fields§
§id: [u8; 16]
The unique identifier for the channel.
config: &'a RollupConfig
A reference to the RollupConfig used to check the max RLP bytes per channel when encoding and accepting the
rlp_length: u64
The rlp length of the channel.
closed: bool
Whether the channel is closed.
frame_number: u16
The frame number.
compressor: C
The compressor.
Implementations§
Source§impl<'a, C> ChannelOut<'a, C>where
C: ChannelCompressor,
impl<'a, C> ChannelOut<'a, C>where
C: ChannelCompressor,
Sourcepub const fn new(
id: [u8; 16],
config: &'a RollupConfig,
compressor: C,
) -> ChannelOut<'a, C>
pub const fn new( id: [u8; 16], config: &'a RollupConfig, compressor: C, ) -> ChannelOut<'a, C>
Creates a new ChannelOut with the given ChannelId.
Sourcepub fn reset(&mut self)
pub fn reset(&mut self)
Resets the ChannelOut to its initial state.
Sourcepub fn add_batch(&mut self, batch: Batch) -> Result<(), ChannelOutError>
pub fn add_batch(&mut self, batch: Batch) -> Result<(), ChannelOutError>
Accepts the given crate::Batch data into the ChannelOut, compressing it into frames.
Sourcepub const fn input_bytes(&self) -> u64
pub const fn input_bytes(&self) -> u64
Returns the total amount of rlp-encoded input bytes.
Sourcepub fn ready_bytes(&self) -> usize
pub fn ready_bytes(&self) -> usize
Returns the number of bytes ready to be output to a frame.
Sourcepub fn flush(&mut self) -> Result<(), ChannelOutError>
pub fn flush(&mut self) -> Result<(), ChannelOutError>
Flush the internal compressor.
Sourcepub fn output_frame(
&mut self,
max_size: usize,
) -> Result<Frame, ChannelOutError>
pub fn output_frame( &mut self, max_size: usize, ) -> Result<Frame, ChannelOutError>
Outputs a Frame from the ChannelOut.
Auto Trait Implementations§
impl<'a, C> Freeze for ChannelOut<'a, C>where
C: Freeze,
impl<'a, C> RefUnwindSafe for ChannelOut<'a, C>where
C: RefUnwindSafe,
impl<'a, C> Send for ChannelOut<'a, C>where
C: Send,
impl<'a, C> Sync for ChannelOut<'a, C>where
C: Sync,
impl<'a, C> Unpin for ChannelOut<'a, C>where
C: Unpin,
impl<'a, C> UnwindSafe for ChannelOut<'a, C>where
C: UnwindSafe,
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> 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