pub struct Secret<T>(/* private fields */);Expand description
Wraps a value that should never appear formatted with Display or Debug in logs or other output.
Secret<T> does implement Debug, but only outputs the inner type name, ie. "Secret<String>";
Forwards the following core traits from its inner type:
CloneCopyPartialeEqEqPartialOrdOrd
§Feature-flagged trait implementations
| Feature | Trait |
|---|---|
core | Debug (1) |
core | Clone (2) |
core | Copy (3) |
core | PartialEq |
core | Eq |
core | PartialOrd |
core | Ord |
core | Hash |
serde | Serialize |
serde | Deserialize |
schemars | JsonSchema |
sqlx | Type |
All trait implementations besides Debug are forwarded from the inner type.
Debug::fmtonly produces the name of the wrapped type, ie."Secret<&str>"T::Cloneenables theexpose_clone(&self) -> Tmethod ofSecret<T>T::Copyenables theexpose_copy(&self) -> Tmethod ofSecret<T>
Implementations§
Trait Implementations§
Source§impl<'de, T: Deserialize<'de>> Deserialize<'de> for Secret<T>
Available on crate feature serde only.
impl<'de, T: Deserialize<'de>> Deserialize<'de> for Secret<T>
Available on crate feature
serde only.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
Source§impl<T: JsonSchema> JsonSchema for Secret<T>
impl<T: JsonSchema> JsonSchema for Secret<T>
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Returns a string that uniquely identifies the schema produced by this type. Read more
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
Whether JSON Schemas generated for this type should be included directly in parent schemas,
rather than being re-used where possible using the
$ref keyword. Read moreSource§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
Source§impl<T: Ord> Ord for Secret<T>
impl<T: Ord> Ord for Secret<T>
Source§impl<T: PartialOrd> PartialOrd for Secret<T>
impl<T: PartialOrd> PartialOrd for Secret<T>
impl<T: Copy> Copy for Secret<T>
impl<T: Eq> Eq for Secret<T>
Auto Trait Implementations§
impl<T> Freeze for Secret<T>where
T: Freeze,
impl<T> RefUnwindSafe for Secret<T>where
T: RefUnwindSafe,
impl<T> Send for Secret<T>where
T: Send,
impl<T> Sync for Secret<T>where
T: Sync,
impl<T> Unpin for Secret<T>where
T: Unpin,
impl<T> UnwindSafe for Secret<T>where
T: UnwindSafe,
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