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
.
Trait Implementations§
impl Eq for KeyPrefix
impl StructuralPartialEq for KeyPrefix
Auto Trait Implementations§
impl Freeze for KeyPrefix
impl RefUnwindSafe for KeyPrefix
impl Send for KeyPrefix
impl Sync for KeyPrefix
impl Unpin for KeyPrefix
impl UnwindSafe for KeyPrefix
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