semiont 0.7.2

Semiont's Rust SDK: the protocol's types, the transport contract and a client of the bus over it, and what a client needs to name its principals and hold its roles, as protocol/specs/ states it.
Documentation
//! Semiont's Rust SDK: a client of a knowledge base (`client`), with a
//! namespace per flow of the protocol (`namespaces`), over any transport.
//! Under it: the protocol's types, channels, error codes and timing, as
//! protocol/specs/ states them; the transport contract and the bus client over it; a
//! client's own bus; the shapes a namespace's methods return (`running`,
//! `cached`), the cache its queries answer from and what refreshes it
//! (`cache`, `refresh`), where a client keeps what must outlive it
//! (`storage`), and the stream's place kept with the caches (`resume`); the flows held as state a consumer reads and watches
//! (`state`); a session with a knowledge base and the registry of the ones
//! an application has signed in to (`session`); the sign-ins `semiont login`
//! keeps, as a storage (`sign_in_store`); the media types a knowledge base
//! admits (`media_types`); the readers of a resource's description, and of
//! its bytes as text (`resources`); the knowledge bases a launcher
//! manages (`discovery`); when a failure is worth another attempt; whether a
//! job is one a claim takes (`job_filter`); a worker's side of the job queue:
//! its claims, the jobs it holds and whether a failed one is retried
//! (`claims`); the readers of an annotation, and the builders of the ones a
//! worker commits (`annotations`);
//! how a knowledge base names its principals and the realm's roles; and the
//! bus log. It does no HTTP and links no telemetry:
//! `semiont-http-transport` carries it over a gateway.

// No unsafe code, but on Windows the one call that gives the sign-in store's
// directory its access list (`sign_in_store`), which the system offers only
// as foreign functions.
#![cfg_attr(not(windows), forbid(unsafe_code))]
#![cfg_attr(windows, deny(unsafe_code))]
// What arrives off the wire is never assumed to be what was expected, and
// neither is anything else: the library has no `unwrap` and no `expect`.
#![cfg_attr(not(test), deny(clippy::unwrap_used, clippy::expect_used))]

pub mod annotations;
pub mod bus;
pub mod bus_log;
pub mod cache;
pub mod cached;
pub mod channels;
pub mod claims;
pub mod client;
pub mod discovery;
pub mod errors;
pub mod event_bus;
pub mod identity;
pub mod job_filter;
pub mod media_types;
pub mod namespaces;
pub mod refresh;
mod required;
pub mod resources;
pub mod resume;
pub mod retry;
mod rfc3339;
pub mod roles;
pub mod running;
pub mod session;
pub mod sign_in_store;
pub mod state;
pub mod state_unit;
pub mod storage;
#[cfg(feature = "testing")]
pub mod testing;
mod text_offsets;
pub mod timing;
pub mod transport;
pub mod types;

pub use required::fault_said;

use std::sync::{Mutex, MutexGuard};

/// What `mutex` guards. A holder that panicked left it as it was, and it is
/// read as it is: nothing here is left half-written across a panic.
pub(crate) fn locked<T: ?Sized>(mutex: &Mutex<T>) -> MutexGuard<'_, T> {
    mutex
        .lock()
        .unwrap_or_else(|poisoned| poisoned.into_inner())
}