pub struct EntityValue { /* private fields */ }Expand description
Fluent builder for entity-typed context values with agreement features.
Produced by entity(); consumed into a Value::Entity via
IntoValue::into_value or EntityValue::build.
§Example
use prosaic_core::{ctx, entity, Value};
use prosaic_core::agreement::{Gender, Number, Definiteness};
let c = ctx! {
user: entity("Alice").fem().sing().defined(),
service: entity("UserService"),
};
match c.get("user").unwrap() {
Value::Entity { name, features } => {
assert_eq!(name, "Alice");
assert_eq!(features.gender, Gender::Fem);
}
_ => panic!("expected Entity"),
}Implementations§
Source§impl EntityValue
impl EntityValue
Sourcepub fn person(self, p: AgreementPerson) -> Self
pub fn person(self, p: AgreementPerson) -> Self
Set the grammatical person.
Sourcepub fn with_features(self, f: AgreementFeatures) -> Self
pub fn with_features(self, f: AgreementFeatures) -> Self
Replace all features at once with a pre-built AgreementFeatures.
Sourcepub fn build(self) -> Value
pub fn build(self) -> Value
Consume this builder into a Value::Entity.
Trait Implementations§
Source§impl Clone for EntityValue
impl Clone for EntityValue
Source§fn clone(&self) -> EntityValue
fn clone(&self) -> EntityValue
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for EntityValue
impl Debug for EntityValue
Source§impl IntoValue for EntityValue
impl IntoValue for EntityValue
fn into_value(self) -> Value
Source§impl PartialEq for EntityValue
impl PartialEq for EntityValue
Source§fn eq(&self, other: &EntityValue) -> bool
fn eq(&self, other: &EntityValue) -> bool
Tests for
self and other values to be equal, and is used by ==.impl Eq for EntityValue
impl StructuralPartialEq for EntityValue
Auto Trait Implementations§
impl Freeze for EntityValue
impl RefUnwindSafe for EntityValue
impl Send for EntityValue
impl Sync for EntityValue
impl Unpin for EntityValue
impl UnsafeUnpin for EntityValue
impl UnwindSafe for EntityValue
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