pub struct Factor {
pub id: String,
pub kind: FactorKind,
pub label: String,
pub targets: Vec<FactorTarget>,
pub source: Option<String>,
}Expand description
A factor mapping onto the body.
Fields§
§id: String§kind: FactorKind§label: String§targets: Vec<FactorTarget>§source: Option<String>Source / provenance reference (a record id, knowledge-source id, or citation).
Implementations§
Source§impl Factor
impl Factor
Sourcepub fn new(
id: impl Into<String>,
kind: FactorKind,
label: impl Into<String>,
) -> Self
pub fn new( id: impl Into<String>, kind: FactorKind, label: impl Into<String>, ) -> Self
Creates a new instance.
Sourcepub fn targeting(
self,
system_id: impl Into<String>,
effect: Effect,
evidence: EvidenceTier,
weight_milli: u32,
) -> Self
pub fn targeting( self, system_id: impl Into<String>, effect: Effect, evidence: EvidenceTier, weight_milli: u32, ) -> Self
Add a (system, effect, evidence, weight) mapping. weight_milli is clamped to 0..=1000.
Sourcepub fn from_source(self, source: impl Into<String>) -> Self
pub fn from_source(self, source: impl Into<String>) -> Self
Attach a source / provenance reference.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Factor
impl<'de> Deserialize<'de> for Factor
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 Factor
impl StructuralPartialEq for Factor
Auto Trait Implementations§
impl Freeze for Factor
impl RefUnwindSafe for Factor
impl Send for Factor
impl Sync for Factor
impl Unpin for Factor
impl UnsafeUnpin for Factor
impl UnwindSafe for Factor
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