mirror of
https://github.com/aljazceru/turso.git
synced 2026-01-28 12:24:23 +01:00
Implement TryFrom<&'a RefValue> for 'a &str
This commit is contained in:
@@ -679,6 +679,17 @@ impl<'a> TryFrom<&'a RefValue> for String {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> TryFrom<&'a RefValue> for &'a str {
|
||||
type Error = LimboError;
|
||||
|
||||
fn try_from(value: &'a RefValue) -> Result<Self, Self::Error> {
|
||||
match value {
|
||||
RefValue::Text(s) => Ok(s.as_str()),
|
||||
_ => Err(LimboError::ConversionError("Expected text value".into())),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// This struct serves the purpose of not allocating multiple vectors of bytes if not needed.
|
||||
/// A value in a record that has already been serialized can stay serialized and what this struct offsers
|
||||
/// is easy acces to each value which point to the payload.
|
||||
|
||||
Reference in New Issue
Block a user