pub struct Preamble {
pub witnesses: usize,
pub constraints: usize,
pub config: Config,
}Expand description
Metadata information of the CDF file
Fields§
§witnesses: usizeWitnesses count
constraints: usizeConstraints count
config: ConfigConfiguration parameters for encoding and decoding
Implementations§
Source§impl Preamble
impl Preamble
Sourcepub const fn new(witnesses: usize, constraints: usize, config: Config) -> Self
pub const fn new(witnesses: usize, constraints: usize, config: Config) -> Self
Create a new preamble instance
Sourcepub fn witness_offset(&self, idx: usize) -> Option<usize>
pub fn witness_offset(&self, idx: usize) -> Option<usize>
Witness offset in CDF, from an index
Sourcepub fn constraint_offset(&self, idx: usize) -> Option<usize>
pub fn constraint_offset(&self, idx: usize) -> Option<usize>
Constraint offset in CDF, from an index
Sourcepub fn source_cache_offset(&self) -> usize
pub fn source_cache_offset(&self) -> usize
Cache starting position
Trait Implementations§
Source§impl DecodableElement for Preamble
impl DecodableElement for Preamble
Source§fn try_from_buffer_in_place<'a, 'b>(
&'a mut self,
ctx: &DecoderContext<'a>,
buf: &'b [u8],
) -> Result<()>
fn try_from_buffer_in_place<'a, 'b>( &'a mut self, ctx: &DecoderContext<'a>, buf: &'b [u8], ) -> Result<()>
Deserialize the type from a given buffer Read more
Source§fn try_from_buffer<'b>(ctx: &DecoderContext<'_>, buf: &'b [u8]) -> Result<Self>
fn try_from_buffer<'b>(ctx: &DecoderContext<'_>, buf: &'b [u8]) -> Result<Self>
Create a new instance of the type from the provided buffer
Source§fn try_decode_in_place<'a, 'b>(
&mut self,
ctx: &DecoderContext<'a>,
buf: &'b [u8],
) -> Result<&'b [u8]>
fn try_decode_in_place<'a, 'b>( &mut self, ctx: &DecoderContext<'a>, buf: &'b [u8], ) -> Result<&'b [u8]>
Write an element from the buffer, and return the remainder bytes Read more
Source§fn try_decode<'a, 'b>(
ctx: &DecoderContext<'a>,
buf: &'b [u8],
) -> Result<(Self, &'b [u8])>
fn try_decode<'a, 'b>( ctx: &DecoderContext<'a>, buf: &'b [u8], ) -> Result<(Self, &'b [u8])>
Write an element from the buffer, and return the remainder bytes Read more
Source§fn try_from_reader<R>(ctx: &DecoderContext<'_>, reader: R) -> Result<Self>where
R: Read,
fn try_from_reader<R>(ctx: &DecoderContext<'_>, reader: R) -> Result<Self>where
R: Read,
Fetch a new element from a context
Source§impl Element for Preamble
impl Element for Preamble
Source§impl EncodableElement for Preamble
impl EncodableElement for Preamble
Source§fn to_buffer(&self, ctx: &mut EncoderContext, buf: &mut [u8])
fn to_buffer(&self, ctx: &mut EncoderContext, buf: &mut [u8])
Write the type into the buffer. Read more
Source§fn to_vec(&self, ctx: &mut EncoderContext) -> Vec<u8> ⓘ
fn to_vec(&self, ctx: &mut EncoderContext) -> Vec<u8> ⓘ
Serialize the object into a bytes array.
impl Copy for Preamble
impl Eq for Preamble
impl StructuralPartialEq for Preamble
Auto Trait Implementations§
impl Freeze for Preamble
impl RefUnwindSafe for Preamble
impl Send for Preamble
impl Sync for Preamble
impl Unpin for Preamble
impl UnwindSafe for Preamble
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