Struct redis_work_queue::Item
source · pub struct Item {
pub id: String,
pub data: Box<[u8]>,
}
Expand description
An item for a work queue. Each item has an ID and associated data.
Fields§
§id: String
§data: Box<[u8]>
Implementations§
source§impl Item
impl Item
sourcepub fn from_json_data<T: Serialize>(data: &T) -> Result<Item>
pub fn from_json_data<T: Serialize>(data: &T) -> Result<Item>
Create a new item with a random id (a uuid). The data is the result of
serde_json::to_vec(data)
.
sourcepub fn data_json<'a, T: Deserialize<'a>>(&'a self) -> Result<T>
pub fn data_json<'a, T: Deserialize<'a>>(&'a self) -> Result<T>
Returns the data, parsed as JSON.
sourcepub fn data_json_static<T: for<'de> Deserialize<'de>>(&self) -> Result<T>
pub fn data_json_static<T: for<'de> Deserialize<'de>>(&self) -> Result<T>
Returns the data, parsed as JSON, with a static lifetime.