pub struct FuncCodeLen(/* private fields */);
Expand description
A newtype containing a function pointer dispatching the read method for a code.
This is a more efficient way to pass a StaticCodeRead
to a method, as
a FuncCodeReader
does not need to do a runtime test to dispatch the correct
code.
Instances can be obtained by calling the new
method with
method with a variant of the Codes
enum, or by calling the
new_with_func
method with a function pointer.
Note that since selection of the code happens in the new
method, it is more efficient to clone a FuncCodeReader
than to create a new one.
Implementations§
Source§impl FuncCodeLen
impl FuncCodeLen
Sourcepub fn new(code: Codes) -> Result<Self>
pub fn new(code: Codes) -> Result<Self>
Return a new FuncCodeLen
for the given code.
§Errors
The method will return an error if there is no constant
for the given code in FuncCodeLen
.
Sourcepub fn new_with_func(len_func: fn(u64) -> usize) -> Self
pub fn new_with_func(len_func: fn(u64) -> usize) -> Self
Return a new FuncCodeReader
for the given function.
Trait Implementations§
Source§impl Clone for FuncCodeLen
impl Clone for FuncCodeLen
Source§fn clone(&self) -> FuncCodeLen
fn clone(&self) -> FuncCodeLen
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl CodeLen for FuncCodeLen
Here we do not depend on the bitstream, so there is no need for a “static”
version of the trait.
impl CodeLen for FuncCodeLen
Here we do not depend on the bitstream, so there is no need for a “static” version of the trait.
Source§impl Debug for FuncCodeLen
impl Debug for FuncCodeLen
Source§impl MemDbgImpl for FuncCodeLen
impl MemDbgImpl for FuncCodeLen
fn _mem_dbg_rec_on( &self, _memdbg_writer: &mut impl Write, _memdbg_total_size: usize, _memdbg_max_depth: usize, _memdbg_prefix: &mut String, _memdbg_is_last: bool, _memdbg_flags: DbgFlags, ) -> Result
fn _mem_dbg_depth_on( &self, writer: &mut impl Write, total_size: usize, max_depth: usize, prefix: &mut String, field_name: Option<&str>, is_last: bool, padded_size: usize, flags: DbgFlags, ) -> Result<(), Error>
Source§impl MemSize for FuncCodeLen
impl MemSize for FuncCodeLen
Source§impl PartialEq for FuncCodeLen
impl PartialEq for FuncCodeLen
impl Copy for FuncCodeLen
impl Eq for FuncCodeLen
impl StructuralPartialEq for FuncCodeLen
Auto Trait Implementations§
impl Freeze for FuncCodeLen
impl RefUnwindSafe for FuncCodeLen
impl Send for FuncCodeLen
impl Sync for FuncCodeLen
impl Unpin for FuncCodeLen
impl UnwindSafe for FuncCodeLen
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
Source§impl<T, U> CastableInto<U> for Twhere
U: CastableFrom<T>,
impl<T, U> CastableInto<U> for Twhere
U: CastableFrom<T>,
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> DowncastableFrom<T> for T
impl<T> DowncastableFrom<T> for T
Source§fn downcast_from(value: T) -> T
fn downcast_from(value: T) -> T
Source§impl<T, U> DowncastableInto<U> for Twhere
U: DowncastableFrom<T>,
impl<T, U> DowncastableInto<U> for Twhere
U: DowncastableFrom<T>,
Source§impl<T> MemDbg for Twhere
T: MemDbgImpl,
impl<T> MemDbg for Twhere
T: MemDbgImpl,
Source§fn mem_dbg(&self, flags: DbgFlags) -> Result<(), Error>
fn mem_dbg(&self, flags: DbgFlags) -> Result<(), Error>
Source§fn mem_dbg_on(
&self,
writer: &mut impl Write,
flags: DbgFlags,
) -> Result<(), Error>
fn mem_dbg_on( &self, writer: &mut impl Write, flags: DbgFlags, ) -> Result<(), Error>
core::fmt::Write
debug infos about the structure memory
usage, expanding all levels of nested structures.Source§fn mem_dbg_depth(&self, max_depth: usize, flags: DbgFlags) -> Result<(), Error>
fn mem_dbg_depth(&self, max_depth: usize, flags: DbgFlags) -> Result<(), Error>
mem_dbg
, but expanding only up to max_depth
levels of nested structures.Source§fn mem_dbg_depth_on(
&self,
writer: &mut impl Write,
max_depth: usize,
flags: DbgFlags,
) -> Result<(), Error>
fn mem_dbg_depth_on( &self, writer: &mut impl Write, max_depth: usize, flags: DbgFlags, ) -> Result<(), Error>
core::fmt::Write
debug infos about the structure memory
usage as mem_dbg_on
, but expanding only up to
max_depth
levels of nested structures.