Skip to main content

AppSpecific

Struct AppSpecific 

Source
pub struct AppSpecific<S: Source> { /* private fields */ }
Expand description

Wrapper source that HMACs the inner source’s probe value with a caller-supplied app_id, emitting a UUID-shaped probe.

§Example

use host_identity::sources::{AppSpecific, MachineIdFile};
use host_identity::{Resolver, Source};

let wrapped = AppSpecific::new(
    MachineIdFile::default(),
    b"com.example.telemetry".to_vec(),
);
let id = Resolver::new().push(wrapped).resolve()?;

Implementations§

Source§

impl<S: Source> AppSpecific<S>

Source

pub fn new(inner: S, app_id: impl Into<Vec<u8>>) -> Self

Wrap inner so its probe value is derived with app_id.

app_id is not secret — privacy comes from not leaking the inner source’s raw value, not from app_id secrecy. Pick a stable byte string that identifies your application (reverse DNS, a random UUID, a git SHA — whichever is convenient and stable across your deployment).

§Label interning

The composed provenance label app-specific:<inner-id> is interned in a process-global map keyed on the inner source’s &'static str identifier, so memory consumption is bounded by the number of distinct inner source kinds ever wrapped — not the number of AppSpecific::new calls. Interned strings are leaked for the program’s lifetime to satisfy the SourceKind::Custom(&'static str) contract.

Trait Implementations§

Source§

impl<S: Source> Debug for AppSpecific<S>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<S: Source> Drop for AppSpecific<S>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl<S: Source> Source for AppSpecific<S>

Source§

fn kind(&self) -> SourceKind

Provenance label for this source. Shown in error messages and the resolved crate::HostId.
Source§

fn probe(&self) -> Result<Option<Probe>, Error>

Attempt to produce a raw identifier. Read more

Auto Trait Implementations§

§

impl<S> Freeze for AppSpecific<S>
where S: Freeze,

§

impl<S> RefUnwindSafe for AppSpecific<S>
where S: RefUnwindSafe,

§

impl<S> Send for AppSpecific<S>

§

impl<S> Sync for AppSpecific<S>

§

impl<S> Unpin for AppSpecific<S>
where S: Unpin,

§

impl<S> UnsafeUnpin for AppSpecific<S>
where S: UnsafeUnpin,

§

impl<S> UnwindSafe for AppSpecific<S>
where S: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.