pub struct Entity {
pub name: String,
pub id: String,
pub data: Value,
}Fields§
§name: String§id: String§data: ValueImplementations§
Source§impl Entity
impl Entity
pub fn new(name: String, id: String, data: Value) -> Self
Sourcepub fn from_json(name: String, data: Value) -> Result<Self>
pub fn from_json(name: String, data: Value) -> Result<Self>
§Errors
Returns an error if the data doesn’t have an ‘id’ field.
pub fn to_json(&self) -> Value
pub fn key(&self) -> Vec<u8> ⓘ
Sourcepub fn deserialize(name: String, id: String, data: &[u8]) -> Result<Self>
pub fn deserialize(name: String, id: String, data: &[u8]) -> Result<Self>
§Errors
Returns an error if checksum verification fails or data is invalid.
pub fn get_field(&self, field: &str) -> Option<&Value>
pub fn extract_index_values(&self, fields: &[String]) -> Vec<(String, Vec<u8>)>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Entity
impl RefUnwindSafe for Entity
impl Send for Entity
impl Sync for Entity
impl Unpin for Entity
impl UnsafeUnpin for Entity
impl UnwindSafe for Entity
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