Struct redis_work_queue::KeyPrefix
source · pub struct KeyPrefix { /* private fields */ }Expand description
A string which should be prefixed to an identifier to generate a database key.
Example
use redis_work_queue::KeyPrefix;
let cv_key = KeyPrefix::from("cv:");
// ...
let cv_id = "abcdef-123456";
assert_eq!(cv_key.of(cv_id), "cv:abcdef-123456");
// let cv_info = db.get(cv_key.of(cv_id));Implementations§
source§impl KeyPrefix
impl KeyPrefix
pub fn new(prefix: String) -> KeyPrefix
sourcepub fn and(&self, other: &str) -> KeyPrefix
pub fn and(&self, other: &str) -> KeyPrefix
Returns the result of prefixing self onto other as a new KeyPrefix.
This is like KeyPrefix::concat except it only borrows self.
sourcepub fn concat(self, other: &str) -> KeyPrefix
pub fn concat(self, other: &str) -> KeyPrefix
Returns the result of prefixing self onto other as a new KeyPrefix.
This is like KeyPrefix::and except it moves self.