Struct ParentalStore

Source
pub struct ParentalStore { /* private fields */ }
Expand description

Protected installation-level parental policies and conservative usage ledger.

Implementations§

Source§

impl ParentalStore

Source

pub fn check_schedule( &self, owner: &str, now: u64, media: &Media, ) -> Result<(), String>

Recheck current category and clock windows without spending an existing grant twice.

Source

pub fn status( &self, owner: &str, now: u64, media: &Media, ) -> Result<Status, String>

Inspect only one owner’s policy and reserved/settled local calendar budgets.

Source

pub fn reserve( &mut self, owner: &str, lease_id: &str, media: Media, requested_seconds: u32, now: u64, ) -> Result<LeaseGrant, String>

Reserve at most ten seconds before audio is admitted. The caller saves before granting. Overlapping transports share temporal coverage rather than spending their duration twice.

Source

pub fn settle( &mut self, owner: &str, lease_id: &str, consumed_ms: u64, now: u64, close: bool, ) -> Result<(), String>

Confirm cumulative consumed milliseconds and close/refund only future activity. Already elapsed time under an active grant is never refunded by a client’s counter. Expired reservations stay fully charged; a crash or late client cannot regain their budget.

Source

pub fn renew( &mut self, owner: &str, lease_id: &str, consumed_ms: u64, requested_seconds: u32, now: u64, ) -> Result<LeaseGrant, String>

Atomically settle a previous grant and reserve the next slice under the same identifier. Consumption counters restart at zero for the returned grant.

Source§

impl ParentalStore

Source

pub fn load(path: &Path) -> Result<Self, String>

Load a private regular document; only initial absence yields an empty store.

Source

pub fn load_optional(path: &Path) -> Result<Option<Self>, String>

Distinguish initial absence from a present private document at the read boundary. Servers can latch observed presence and refuse a subsequent disappearance.

Source

pub fn save(&self, path: &Path) -> Result<(), String>

Publish one validated replacement atomically; the caller holds StoreLock.

Source

pub fn policy(&self, owner: &str) -> PolicySnapshot

Return only the selected owner’s policy, including explicit unrestricted defaults.

Source

pub fn set_policy( &mut self, owner: &str, policy: Policy, expected_revision: u64, ) -> Result<PolicySnapshot, String>

Replace an administrator-approved policy without altering credentials or opinions.

Source

pub fn set_policy_by( &mut self, owner: &str, administrator: Option<&str>, policy: Policy, expected_revision: u64, ) -> Result<PolicySnapshot, String>

Apply an authenticated administrator’s edit and claim/release its exclusive lock. Legacy unclaimed rules may be claimed; a local token cannot override a named owner.

Source

pub fn supervises(&self, administrator: &str) -> bool

Whether an administrator still owns at least one active supervision lock.

Trait Implementations§

Source§

impl Clone for ParentalStore

Source§

fn clone(&self) -> ParentalStore

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ParentalStore

Source§

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

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

impl Default for ParentalStore

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for ParentalStore

Source§

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 Serialize for ParentalStore

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<S> FromSample<S> for S

§

fn from_sample_(s: S) -> S

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.

§

impl<F, T> IntoSample<T> for F
where T: FromSample<F>,

§

fn into_sample(self) -> T

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
§

impl<T, U> ToSample<U> for T
where U: FromSample<T>,

§

fn to_sample_(self) -> U

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.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

§

impl<S, T> Duplex<S> for T
where T: FromSample<S> + ToSample<S>,