pub struct ConfigSections { /* private fields */ }Expand description
The sections a request reads, and how to read each one.
Built once, at startup, and handed to the framework adapter. Each entry is a closure the adapter calls when a request begins — never during it, which is what makes the reads agree.
Implementations§
Source§impl Sections
impl Sections
Sourcepub fn section<T, F>(self, read: F) -> Sections
pub fn section<T, F>(self, read: F) -> Sections
Adds one section, read by read.
let sections = Sections::new().section(try_current);In a service read is || Database::try_current(), or
move || handle.current() for a Dynamic<T>.
Registering the same type twice keeps the last reader, so a composed list can override one entry without rebuilding it.
Sourcepub fn section_with_generation<T, F, G>(
self,
read: F,
generation: G,
) -> Sections
pub fn section_with_generation<T, F, G>( self, read: F, generation: G, ) -> Sections
Sourcepub fn is_consistent(&self) -> bool
pub fn is_consistent(&self) -> bool
Sourcepub fn take(&self) -> Snapshot
pub fn take(&self) -> Snapshot
Reads every section once.
Called by the adapter when a request begins. A section that has not
loaded is left out rather than failing the request: the handler that
asks for it gets NotInScope::NotLoaded, and a handler that does
not ask is unaffected.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Sections
impl !UnwindSafe for Sections
impl Freeze for Sections
impl Send for Sections
impl Sync for Sections
impl Unpin for Sections
impl UnsafeUnpin for Sections
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