pub struct Sources {
pub version: u64,
pub sources: Vec<SourceClass>,
}Expand description
sources.yaml, typed: the classes in declared order.
Fields§
§version: u64The format version; only SOURCES_VERSION is read.
sources: Vec<SourceClass>The classes, in the order they are reported.
Implementations§
Source§impl Sources
impl Sources
Sourcepub fn load(repo: &Repository) -> Result<Self, Error>
pub fn load(repo: &Repository) -> Result<Self, Error>
Read sources.yaml from the repository’s knowledge section.
Sourcepub fn parse(path: &Path, text: &str) -> Result<Self, Error>
pub fn parse(path: &Path, text: &str) -> Result<Self, Error>
Parse and validate the text of a sources.yaml.
use majordomus_cli::discovery::Sources;
use std::path::Path;
let text = "version: 1\nsources:\n - id: rule\n kind: rule\n discovery: vcs\n pathspec: ':(glob).ai/repo/rules/**/*.md'\n required: true\n";
let sources = Sources::parse(Path::new("sources.yaml"), text).unwrap();
assert_eq!(sources.sources[0].kind, "rule");
assert!(Sources::parse(Path::new("s"), &text.replace("version: 1", "version: 2")).is_err());Trait Implementations§
Source§impl<'de> Deserialize<'de> for Sources
impl<'de> Deserialize<'de> for Sources
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for Sources
impl StructuralPartialEq for Sources
Auto Trait Implementations§
impl Freeze for Sources
impl RefUnwindSafe for Sources
impl Send for Sources
impl Sync for Sources
impl Unpin for Sources
impl UnsafeUnpin for Sources
impl UnwindSafe for Sources
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
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> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
§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
Compare self to
key and return true if they are equal.