pub trait FileCollector: Collector {
// Required methods
fn get_dependency_filename(&self) -> String;
fn get_dependencies(
&self,
dependency_file_content: &str,
licrc: &LicRc,
) -> RetrievedDependencyStreamResult<'_>;
}
Expand description
Trait to be implemented for every Collector
dealing with a dependency file (package-lock.json, pubspec.yaml…).
Required Methods§
Sourcefn get_dependency_filename(&self) -> String
fn get_dependency_filename(&self) -> String
Gets the name of the file holding all the dependencies. i.e. for npm package-lock.json, for rust cargo.lock
Sourcefn get_dependencies(
&self,
dependency_file_content: &str,
licrc: &LicRc,
) -> RetrievedDependencyStreamResult<'_>
fn get_dependencies( &self, dependency_file_content: &str, licrc: &LicRc, ) -> RetrievedDependencyStreamResult<'_>
Returns a stream of RetrievedDependency
ready to be validated.
It accepts a &str with the content of the dependency file
and a function to filter the dependencies that we don’t want to process,
mainly because the user has expressed the will to not to do so.
§Errors
Will return an Error
if the parsing of the dependency file fails.