pub struct Deterministic(pub String);Expand description
A column encrypted deterministically: equal values give equal stored
texts, so query().eq("email", Deterministic::from(email)) finds the row
and a UNIQUE index works.
Same reading and serializing rules as Encrypted. Equal values being
visible as equal texts is the trade-off: use it only for columns you
must look up.
§Examples
use ocre::{IntoParam, encryption::{self, Deterministic, Encryptor}};
encryption::install(Encryptor::new(&"t".repeat(64), &[]).unwrap());
let a = Deterministic::from("ada@example.com").into_param();
assert_eq!(a, Deterministic::from("ada@example.com").into_param());Tuple Fields§
§0: StringImplementations§
Trait Implementations§
Source§impl Clone for Deterministic
impl Clone for Deterministic
Source§fn clone(&self) -> Deterministic
fn clone(&self) -> Deterministic
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 Deterministic
impl Debug for Deterministic
Source§impl<'de> Deserialize<'de> for Deterministic
impl<'de> Deserialize<'de> for Deterministic
Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for Deterministic
impl Display for Deterministic
impl Eq for Deterministic
Source§impl From<&str> for Deterministic
impl From<&str> for Deterministic
Source§impl From<String> for Deterministic
impl From<String> for Deterministic
Source§impl IntoParam for Deterministic
Binds the encrypted text. Without installed keys (no valid
SECRET_KEY_BASE) it binds NULL, which a NOT NULL column
refuses; the error is logged.
impl IntoParam for Deterministic
Binds the encrypted text. Without installed keys (no valid
SECRET_KEY_BASE) it binds NULL, which a NOT NULL column
refuses; the error is logged.
Source§fn into_param(self) -> Param
fn into_param(self) -> Param
Converts the value into a bound parameter.
Source§impl PartialEq for Deterministic
impl PartialEq for Deterministic
Source§fn eq(&self, other: &Deterministic) -> bool
fn eq(&self, other: &Deterministic) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for Deterministic
impl Serialize for Deterministic
impl StructuralPartialEq for Deterministic
Auto Trait Implementations§
impl Freeze for Deterministic
impl RefUnwindSafe for Deterministic
impl Send for Deterministic
impl Sync for Deterministic
impl Unpin for Deterministic
impl UnsafeUnpin for Deterministic
impl UnwindSafe for Deterministic
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.