pub struct Candidate {
pub name: String,
pub sources: Vec<Source>,
pub variants: Vec<Vec<usize>>,
pub identical: bool,
pub in_store: bool,
}Expand description
Foreign entries sharing one name.
Fields§
§name: String§sources: Vec<Source>§variants: Vec<Vec<usize>>The sources grouped by definition (indexes into sources), in
first-seen order: sources that read as the same store fields and
tool filter share a variant; one that cannot be imported is a
variant of its own.
identical: boolOne variant, and it can be imported.
in_store: boolThe store already has a server with this id.
Implementations§
Source§impl Candidate
impl Candidate
Sourcepub fn variant_of(&self, key: &str) -> Option<usize>
pub fn variant_of(&self, key: &str) -> Option<usize>
The variant holding the source with key key (Source::key).
Sourcepub fn variant_def(&self, v: usize) -> Result<&ImportedDef, &CoreError>
pub fn variant_def(&self, v: usize) -> Result<&ImportedDef, &CoreError>
The definition of variant v, or why it cannot be imported.
Sourcepub fn importable(&self) -> Vec<usize>
pub fn importable(&self) -> Vec<usize>
The variants that can be imported.
Sourcepub fn enables(&self, v: usize) -> bool
pub fn enables(&self, v: usize) -> bool
Importing variant v enables the server for some client (it was
found in a user file); otherwise it becomes a definition only.
Sourcepub fn suggested_ids(&self) -> Vec<String>
pub fn suggested_ids(&self) -> Vec<String>
The store id each variant gets by default: the name in lower case
for the first variant that can be imported, name-<client> for the
others (the client of the variant’s first user file, else of its
first source), numbered when two would be the same.
Sourcepub fn choice_for(
&self,
source: &str,
rename: bool,
) -> Result<VariantChoice, CoreError>
pub fn choice_for( &self, source: &str, rename: bool, ) -> Result<VariantChoice, CoreError>
Importing the variant of the source with key source
(Source::key), else of the source found in client source (its
user file first), under the name, or with rename as
name-<client>.