pub struct Payload {
pub source: Source,
pub maybe_name: Option<String>,
pub maybe_format: Option<String>,
pub content: Vec<u8>,
}Expand description
Raw bytes for one configuration entry, with its declaring Source.
A loader returns one Payload per entry it finds. Fields:
source— the concrete resource this entry came from. When oneSourceexpands to several entries (e.g. a directory of files), set this to the specific resource loaded, not the original directory — clone the incoming source and narrow it withSource::with_resource. Downstream stages surface it in diagnostics.maybe_name— the entry’s name, orNonefor an unnamed payload. AllNone-named payloads merge together into the root; distinct names stay separate. Named entries with the same name also merge.maybe_format— a hint for the parser stage selecting the parser (json,env, …), orNoneto let the parser infer/default. It is a hint, not a guarantee.content— the unparsed bytes, passed through verbatim to the parser.
Lowercase convention: built-in loaders lower-case maybe_name and maybe_format when
their Source lowercase option is true (the default). Custom loaders are encouraged to
follow the same convention so entry names merge predictably across sources.
Fields§
§source: SourceConcrete resource this entry was loaded from (narrowed from the incoming Source).
maybe_name: Option<String>Entry name; None merges into the root alongside other unnamed payloads.
maybe_format: Option<String>Parser hint (e.g. json, env); None lets the parser infer or default.
content: Vec<u8>Unparsed bytes, forwarded verbatim to the parser stage.
Trait Implementations§
impl StructuralPartialEq for Payload
Auto Trait Implementations§
impl Freeze for Payload
impl RefUnwindSafe for Payload
impl Send for Payload
impl Sync for Payload
impl Unpin for Payload
impl UnsafeUnpin for Payload
impl UnwindSafe for Payload
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