pub struct IdSet { /* private fields */ }Available on crate feature
api only.Expand description
A set of message ids, such as the ids an Id type knows, see
Id::IDS.
A set is built at compile time out of the ids of one define! list and
the sets of the lists it includes, so it is cheap to construct but looking
an id up in it is a linear scan. It is used to check, at compile time, that
two lists which share a connection never use the same id.
§Examples
Checking in a test (or a const item) that two lists which are never
included into one another, but are carried on the same connection, do not
share an id:
use musli::{Decode, Encode};
use musli_web::api::Id;
mod app {
#[derive(Encode, Decode)]
pub struct HelloRequest;
api::define! {
pub type Hello;
impl Endpoint for Hello {
impl Request for HelloRequest;
type Response<'de> = ();
}
}
}
mod lib {
#[derive(Encode, Decode)]
pub struct LoginRequest;
api::define! {
#[musli(id = 32000)]
pub type Login;
impl Endpoint for Login {
impl Request for LoginRequest;
type Response<'de> = ();
}
}
}
const _: () = assert!(app::Request::IDS.is_disjoint(&lib::Request::IDS));
assert_eq!(app::Request::IDS.first_shared(&lib::Request::IDS), None);Implementations§
Trait Implementations§
Auto Trait Implementations§
impl Freeze for IdSet
impl RefUnwindSafe for IdSet
impl Send for IdSet
impl Sync for IdSet
impl Unpin for IdSet
impl UnsafeUnpin for IdSet
impl UnwindSafe for IdSet
Blanket Implementations§
impl<Token, Builder, How> AllPropsFor<Builder, How> for Tokenwhere
Builder: Buildable<Token>,
<Builder as Buildable<Token>>::WrappedToken: HasAllProps<<Builder as Buildable<Token>>::Output, How>,
impl<Token, Builder, How> AllPropsFor<Builder, How> for Tokenwhere
Builder: Buildable<Token>,
<Builder as Buildable<Token>>::WrappedToken: HasAllProps<<Builder as Buildable<Token>>::Output, How>,
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> HasAllProps<(), T> for T
impl<T> HasAllProps<(), T> for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoPropValue<Option<T>> for T
impl<T> IntoPropValue<Option<T>> for T
Source§fn into_prop_value(self) -> Option<T>
fn into_prop_value(self) -> Option<T>
Convert
self to a value of a Properties struct.Source§impl<T> IntoPropValue<Option<T>> for T
impl<T> IntoPropValue<Option<T>> for T
Source§fn into_prop_value(self) -> Option<T>
fn into_prop_value(self) -> Option<T>
Convert
self to a value of a Properties struct.Source§impl<T> IntoPropValue<T> for T
impl<T> IntoPropValue<T> for T
Source§fn into_prop_value(self) -> T
fn into_prop_value(self) -> T
Convert
self to a value of a Properties struct.Source§impl<T> IntoPropValue<T> for T
impl<T> IntoPropValue<T> for T
Source§fn into_prop_value(self) -> T
fn into_prop_value(self) -> T
Convert
self to a value of a Properties struct.