pub struct AttributeValue<'a>(pub Cow<'a, [u8]>);
Expand description
Wrapper type that is used as value for the Attributes
map.
Tuple Fields§
§0: Cow<'a, [u8]>
Implementations§
Source§impl Value<'_>
impl Value<'_>
Sourcepub fn unescape(&self) -> Result<Cow<'_, str>, Error>
pub fn unescape(&self) -> Result<Cow<'_, str>, Error>
Return the unescaped value using UTF-8 encoding.
§Errors
Throws an error if the value could not be unescaped.
Sourcepub fn unescape_with<'entity>(
&self,
resolve_entity: impl FnMut(&str) -> Option<&'entity str>,
) -> Result<Cow<'_, str>, Error>
pub fn unescape_with<'entity>( &self, resolve_entity: impl FnMut(&str) -> Option<&'entity str>, ) -> Result<Cow<'_, str>, Error>
Return the unescaped value using UTF-8 encoding and the passed function to resolve the escaped string.
For details see unescape_with
.
§Errors
Throws an error if the value could not be unescaped.
Sourcepub fn decode_and_unescape(
&self,
encoding: &'static Encoding,
) -> Result<Cow<'_, str>, Error>
pub fn decode_and_unescape( &self, encoding: &'static Encoding, ) -> Result<Cow<'_, str>, Error>
Decodes and unescape the value using the passed encoding
.
§Errors
Throws an error if the value could not be unescaped.
Sourcepub fn decode_and_unescape_with<'entity>(
&self,
encoding: &'static Encoding,
resolve_entity: impl FnMut(&str) -> Option<&'entity str>,
) -> Result<Cow<'_, str>, Error>
pub fn decode_and_unescape_with<'entity>( &self, encoding: &'static Encoding, resolve_entity: impl FnMut(&str) -> Option<&'entity str>, ) -> Result<Cow<'_, str>, Error>
Return the unescaped value using the passed encoding
and the passed
function to resolve the escaped string.
For details see unescape_with
.
§Errors
Throws an error if the value could not be unescaped.
Trait Implementations§
Source§impl<'a> Ord for Value<'a>
impl<'a> Ord for Value<'a>
Source§impl<'a> PartialOrd for Value<'a>
impl<'a> PartialOrd for Value<'a>
impl<'a> Eq for Value<'a>
impl<'a> StructuralPartialEq for Value<'a>
Auto Trait Implementations§
impl<'a> Freeze for Value<'a>
impl<'a> RefUnwindSafe for Value<'a>
impl<'a> Send for Value<'a>
impl<'a> Sync for Value<'a>
impl<'a> Unpin for Value<'a>
impl<'a> UnwindSafe for Value<'a>
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.