pub struct ActivityItem {
pub created_dtm: i64,
pub action: String,
pub description: String,
}
Expand description
Supporting Classes
Fields§
§created_dtm: i64
§action: String
§description: String
Implementations§
Source§impl ActivityItem
impl ActivityItem
Sourcepub fn new(name: String, descr: String) -> Self
pub fn new(name: String, descr: String) -> Self
This is the constructor function.
#Example
extern crate scaffolding_core;
use scaffolding_core::*;
let mut activity_item = ActivityItem::new("updated".to_string(), "This was updated".to_string());
Sourcepub fn deserialized(serialized: &[u8]) -> Result<ActivityItem, DeserializeError>
pub fn deserialized(serialized: &[u8]) -> Result<ActivityItem, DeserializeError>
This function instantiates an ActivityItem from a JSON string.
#Example
extern crate scaffolding_core;
use scaffolding_core::*;
let serialized = r#"{
"created_dtm":1711760135,
"action":"updated",
"description":"The object has been updated."
}"#;
let mut activity_item = ActivityItem::deserialized(&serialized.as_bytes()).unwrap();
assert_eq!(activity_item.created_dtm, 1711760135);
assert_eq!(activity_item.action, "updated".to_string());
assert_eq!(activity_item.description, "The object has been updated.".to_string());
Sourcepub fn serialize(&mut self) -> String
pub fn serialize(&mut self) -> String
This function converts the ActivityItem to a serialize JSON string.
#Example
extern crate scaffolding_core;
use scaffolding_core::*;
let mut activity_item = ActivityItem::new("updated".to_string(), "This was updated".to_string());
let json = activity_item.serialize();
println!("{}", json);
Trait Implementations§
Source§impl Clone for ActivityItem
impl Clone for ActivityItem
Source§fn clone(&self) -> ActivityItem
fn clone(&self) -> ActivityItem
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for ActivityItem
impl Debug for ActivityItem
Source§impl<'de> Deserialize<'de> for ActivityItem
impl<'de> Deserialize<'de> for ActivityItem
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for ActivityItem
impl RefUnwindSafe for ActivityItem
impl Send for ActivityItem
impl Sync for ActivityItem
impl Unpin for ActivityItem
impl UnwindSafe for ActivityItem
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