pub struct Entities { /* private fields */ }Expand description
The entities of a report and their facts.
Implementations§
Source§impl Entities
impl Entities
pub fn new() -> Self
Sourcepub fn add(
&mut self,
label: &str,
aliases: &[String],
group: bool,
facts: &Value,
)
pub fn add( &mut self, label: &str, aliases: &[String], group: bool, facts: &Value, )
Adds the entity label with the numbers of facts (a JSON value: its numbers as they
are, its strings as texts). An entity added twice keeps the facts and aliases of both.
Sourcepub fn add_group(&mut self, label: &str)
pub fn add_group(&mut self, label: &str)
Adds a group word that names no entity (“all stores”, “campaigns”).
Sourcepub fn add_json(&mut self, value: &Value, label_key: &str) -> Result<(), String>
pub fn add_json(&mut self, value: &Value, label_key: &str) -> Result<(), String>
Adds the entities of a JSON value:
- a list of records, each naming its entity under
label_keywith optionalaliases(a list of strings) andgroup(a bool); every other field holds the entity’s facts:[{"entity": "Garden", "aliases": ["garden goods"], "revenue": 1200}]. Records with the same label make one entity, so{entity, metric, value}rows work too; - an object of facts per label:
{"Garden": {"revenue": 1200}, "Toys": {"revenue": 900}}.
Returns what is wrong with the value, if anything.
Sourcepub fn misattributed(
&self,
text: &str,
scope: Option<&str>,
rules: AttributionRules,
) -> Vec<Misattributed>
pub fn misattributed( &self, text: &str, scope: Option<&str>, rules: AttributionRules, ) -> Vec<Misattributed>
The figures of text given to an entity whose facts do not hold them. scope is the
label of the entity the text is about, if any: an entity no source lists holds nothing.
Trait Implementations§
Auto Trait Implementations§
impl Forget for Entities
impl Freeze for Entities
impl Move for Entities
impl RefUnwindSafe for Entities
impl Send for Entitieswhere
RawVecInner: Send,
impl Sync for Entitieswhere
RawVecInner: Sync,
impl Unpin for Entities
impl UnsafeUnpin for Entities
impl UnwindSafe for Entitieswhere
RawVecInner: 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
Mutably borrows from an owned value. Read more