Struct goblin::strtab::Strtab [−][src]
pub struct Strtab<'a> { /* fields omitted */ }
Expand description
A common string table format which is indexed by byte offsets (and not
member index). Constructed using parse
with your choice of delimiter. Please be careful.
Implementations
Creates a Strtab
with bytes
as the backing string table, using delim
as the delimiter between entries.
NB: this does not preparse the string table, which can have non-optimal access patterns. See https://github.com/m4b/goblin/pull/275#issue-660364025
Creates a Strtab
directly without bounds check and without parsing it.
This is potentially unsafe and should only be used if feature = "alloc"
is disabled.
Gets a str reference from the backing bytes starting at byte offset
.
If the index is out of bounds, None
is returned. Panics if bytes are invalid UTF-8.
Use this method if the Strtab
was created using from_slice_unparsed()
.
Parses a Strtab
from bytes
at offset
with len
size as the backing string table, using delim
as the delimiter.
Errors if bytes are invalid UTF-8.
Requires feature = "alloc"
Parses a Strtab
with bytes
as the backing string table, using delim
as the delimiter between entries.
Requires feature = "alloc"
Converts the string table to a vector of parsed strings.
Requires feature = "alloc"
Safely gets a str reference from the parsed table starting at byte offset
.
If the index is out of bounds, None
is returned.
Requires feature = "alloc"
👎 Deprecated since 0.4.2: Use from_slice_unparsed() instead
Use from_slice_unparsed() instead
Construct a strtab from a ptr
, and a size
, using delim
as the delimiter
Safety
This function creates a Strtab
directly from a raw pointer and size
Trait Implementations
Auto Trait Implementations
impl<'a> RefUnwindSafe for Strtab<'a>
impl<'a> UnwindSafe for Strtab<'a>