pub struct DuckStringView<'a> { /* private fields */ }Expand description
A parsed view of a duckdb_string_t value.
This type borrows from the raw vector data — it does not allocate.
§Safety
The data slice from which this view is created must outlive the view.
For pointer-format strings, the pointed-to heap data must also be valid.
Implementations§
Source§impl<'a> DuckStringView<'a>
impl<'a> DuckStringView<'a>
Sourcepub const fn from_bytes(raw: &'a [u8; 16]) -> Self
pub const fn from_bytes(raw: &'a [u8; 16]) -> Self
Creates a DuckStringView from the raw 16-byte representation.
The input is a fixed-size [u8; 16] reference, so the size is
enforced at compile time.
Sourcepub fn as_str(&self) -> Option<&'a str>
pub fn as_str(&self) -> Option<&'a str>
Returns the string as a UTF-8 str slice, or None if it is not valid UTF-8.
The returned &'a str has the same lifetime as the underlying data slice —
not the lifetime of self. This allows the result to outlive the DuckStringView.
§Safety
For pointer-format strings (length > 12), the pointer stored at bytes 8–15
must be a valid pointer to at least self.length bytes of string data that
is live for lifetime 'a.
Trait Implementations§
Source§impl<'a> Clone for DuckStringView<'a>
impl<'a> Clone for DuckStringView<'a>
Source§fn clone(&self) -> DuckStringView<'a>
fn clone(&self) -> DuckStringView<'a>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more