pub struct Source<F> {
pub file: Option<FileSource<F>>,
}Expand description
Where a table is kept: an object holding exactly one source kind, open to more kinds (a SQL database, an HTTP API) without changing what sits beside it.
F is the caller’s format choice, a Codec that is also configuration (an enum of the
formats a plugin offers). In a configuration:
{ "file": { "path": "accounts.toml", "format": "toml" } }Fields§
§file: Option<FileSource<F>>Records in one private file.
Implementations§
Source§impl<F> Source<F>
impl<F> Source<F>
Sourcepub fn max_bytes(self, max: u32) -> Self
pub fn max_bytes(self, max: u32) -> Self
This source with a size bound, in bytes, for the file.
Sourcepub fn max_bytes_unless_set(self, max: u32) -> Self
pub fn max_bytes_unless_set(self, max: u32) -> Self
This source with max as the size bound, unless one is set: a provider sizes the
default from the number of records it allows.
Sourcepub fn sibling(&self, suffix: &str) -> Selfwhere
F: Clone,
pub fn sibling(&self, suffix: &str) -> Selfwhere
F: Clone,
The same kind of source beside this one, for a second table: a file source becomes
the file named <path>.<suffix> in the same format.
Sourcepub fn open<T>(&self, section: &str) -> Result<Arc<dyn Table<T>>, SourceError>
pub fn open<T>(&self, section: &str) -> Result<Arc<dyn Table<T>>, SourceError>
The table of T under section this source names. Nothing is read yet.
§Errors
SourceError::Invalid when no source kind is set or the file’s path is blank.
Trait Implementations§
Source§impl<F> Describe for Source<F>where
F: Describe + Inspect,
impl<F> Describe for Source<F>where
F: Describe + Inspect,
impl<F: Eq> Eq for Source<F>
impl<F> Fields for Source<F>where
F: Describe + Inspect,
impl<F: PartialEq> StructuralPartialEq for Source<F>
Auto Trait Implementations§
impl<F> Freeze for Source<F>where
F: Freeze,
impl<F> RefUnwindSafe for Source<F>where
F: RefUnwindSafe,
impl<F> Send for Source<F>where
F: Send,
impl<F> Sync for Source<F>where
F: Sync,
impl<F> Unpin for Source<F>where
F: Unpin,
impl<F> UnsafeUnpin for Source<F>where
F: UnsafeUnpin,
impl<F> UnwindSafe for Source<F>where
F: UnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.