pub struct MountedSchemas { /* private fields */ }Available on crate feature
domain only.Expand description
The schemas a DomainState serves, resolved once at startup.
Domain::schema allocates, so resolving a
resource’s schema per request would cost a full domain walk on every call.
This holds them alongside the base path each is mounted at.
ⓘ
let schemas = MountedSchemas::new(&domain, [("todo", "/todos")])?;Implementations§
Source§impl MountedSchemas
impl MountedSchemas
Sourcepub fn new<'a>(
domain: &Domain,
mounts: impl IntoIterator<Item = (&'a str, &'a str)>,
) -> Result<Self, String>
pub fn new<'a>( domain: &Domain, mounts: impl IntoIterator<Item = (&'a str, &'a str)>, ) -> Result<Self, String>
Resolve each resource’s schema and pair it with its base path.
Fails naming the first resource the domain does not register, since a route mounted on a resource that does not exist should stop startup rather than 500 on its first request.
Auto Trait Implementations§
impl Freeze for MountedSchemas
impl RefUnwindSafe for MountedSchemas
impl Send for MountedSchemas
impl Sync for MountedSchemas
impl Unpin for MountedSchemas
impl UnsafeUnpin for MountedSchemas
impl UnwindSafe for MountedSchemas
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