pub struct SerializedTask { /* private fields */ }Expand description
Serialized task data for storage and transmission
§Examples
use reinhardt_tasks::SerializedTask;
let task = SerializedTask::new(
"send_email".to_string(),
r#"{"to":"user@example.com","subject":"Hello"}"#.to_string(),
);
assert_eq!(task.name(), "send_email");Implementations§
Source§impl SerializedTask
impl SerializedTask
Sourcepub fn new(name: String, data: String) -> Self
pub fn new(name: String, data: String) -> Self
Create a new serialized task
§Examples
use reinhardt_tasks::SerializedTask;
let task = SerializedTask::new("process_data".to_string(), "{}".to_string());Sourcepub fn name(&self) -> &str
pub fn name(&self) -> &str
Get the task name
§Examples
use reinhardt_tasks::SerializedTask;
let task = SerializedTask::new("task_name".to_string(), "{}".to_string());
assert_eq!(task.name(), "task_name");Sourcepub fn data(&self) -> &str
pub fn data(&self) -> &str
Get the task data
§Examples
use reinhardt_tasks::SerializedTask;
let task = SerializedTask::new("task".to_string(), r#"{"key":"value"}"#.to_string());
assert_eq!(task.data(), r#"{"key":"value"}"#);Trait Implementations§
Source§impl Clone for SerializedTask
impl Clone for SerializedTask
Source§fn clone(&self) -> SerializedTask
fn clone(&self) -> SerializedTask
Returns a duplicate 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 SerializedTask
impl Debug for SerializedTask
Source§impl<'de> Deserialize<'de> for SerializedTask
impl<'de> Deserialize<'de> for SerializedTask
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 SerializedTask
impl RefUnwindSafe for SerializedTask
impl Send for SerializedTask
impl Sync for SerializedTask
impl Unpin for SerializedTask
impl UnsafeUnpin for SerializedTask
impl UnwindSafe for SerializedTask
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