pub enum StatementObject {
Agent(Agent),
Group(Group),
StatementRef(StatementRef),
SubStatement(Box<SubStatement>),
Activity(Activity),
}
Expand description
Enumeration representing the subject (or target) of an action (a Verb) carried out by an Actor (an Agent or a Group) captured in a Statement.
The exact variant of the object is gleaned –explicitly most of the times
but implicitly in special cases– from its objectType
property value (a
variant of ObjectType).
IMPORTANT (rsn) - xAPI (Section 4.2.2 Statement, as well as 4.2.2.3 Object for the Object As Sub-Statement Table) define the Object of a Statement as “Activity, Agent, or another Statement that is the Object of the Statement.” only. However, other sections of the same document mention it can also be a Group. Conformance tests, show that this is the case and that it applies for both Statement and SubStatement.
Variants§
Agent(Agent)
The object is an Agent.
Group(Group)
The object is a Group.
StatementRef(StatementRef)
The object is a Statement-Reference.
SubStatement(Box<SubStatement>)
The object is a Sub-Statement.
Activity(Activity)
The object is an Activity.
Implementations§
Source§impl StatementObject
impl StatementObject
Sourcepub fn from_activity(obj: Activity) -> Self
pub fn from_activity(obj: Activity) -> Self
Construct a variant from the given Activity instance.
Sourcepub fn from_agent(obj: Agent) -> Self
pub fn from_agent(obj: Agent) -> Self
Construct a variant from the given Agent instance.
Sourcepub fn from_group(obj: Group) -> Self
pub fn from_group(obj: Group) -> Self
Construct a variant from the given Group instance]
Sourcepub fn from_statement_ref(obj: StatementRef) -> Self
pub fn from_statement_ref(obj: StatementRef) -> Self
Construct a variant from the given StatementRef instance.
Sourcepub fn from_sub_statement(obj: SubStatement) -> Self
pub fn from_sub_statement(obj: SubStatement) -> Self
Construct a variant from the given SubStatement instance.
Sourcepub fn is_activity(&self) -> bool
pub fn is_activity(&self) -> bool
Return TRUE if this is an Activity variant or FALSE otherwise.
Sourcepub fn is_statement_ref(&self) -> bool
pub fn is_statement_ref(&self) -> bool
Return TRUE if this is an StatementRef variant or FALSE otherwise.
Sourcepub fn is_sub_statement(&self) -> bool
pub fn is_sub_statement(&self) -> bool
Return TRUE if this is a SubStatement variant or FALSE otherwise.
Sourcepub fn as_activity(&self) -> Result<Activity, DataError>
pub fn as_activity(&self) -> Result<Activity, DataError>
Return the target Activity if it was set; None
otherwise.
Sourcepub fn as_statement_ref(&self) -> Result<StatementRef, DataError>
pub fn as_statement_ref(&self) -> Result<StatementRef, DataError>
Return the target if it was a Statement-Reference. Raise DataError otherwise.
Sourcepub fn as_sub_statement(&self) -> Result<SubStatement, DataError>
pub fn as_sub_statement(&self) -> Result<SubStatement, DataError>
Return the target if it was a Sub-Statement. Raise DataError otherwise.
Trait Implementations§
Source§impl Debug for StatementObject
impl Debug for StatementObject
Source§impl<'de> Deserialize<'de> for StatementObject
impl<'de> Deserialize<'de> for StatementObject
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>,
Source§impl Display for StatementObject
impl Display for StatementObject
Source§impl Fingerprint for StatementObject
impl Fingerprint for StatementObject
Source§impl PartialEq for StatementObject
impl PartialEq for StatementObject
Source§impl Serialize for StatementObject
impl Serialize for StatementObject
Source§impl Validate for StatementObject
impl Validate for StatementObject
Source§fn validate(&self) -> Vec<ValidationError>
fn validate(&self) -> Vec<ValidationError>
Source§fn is_valid(&self) -> bool
fn is_valid(&self) -> bool
Source§fn check_validity(&self) -> Result<(), ValidationError>
fn check_validity(&self) -> Result<(), ValidationError>
impl StructuralPartialEq for StatementObject
Auto Trait Implementations§
impl Freeze for StatementObject
impl RefUnwindSafe for StatementObject
impl Send for StatementObject
impl Sync for StatementObject
impl Unpin for StatementObject
impl UnwindSafe for StatementObject
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoCollection<T> for T
impl<T> IntoCollection<T> for T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
Source§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self
with the foreground set to
value
.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red()
and
green()
, which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg()
:
use yansi::{Paint, Color};
painted.fg(Color::White);
Set foreground color to white using white()
.
use yansi::Paint;
painted.white();
Source§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
Source§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
Source§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
Source§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
Source§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
Source§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
Source§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
Source§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
Source§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self
with the background set to
value
.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red()
and
on_green()
, which have the same functionality but
are pithier.
§Example
Set background color to red using fg()
:
use yansi::{Paint, Color};
painted.bg(Color::Red);
Set background color to red using on_red()
.
use yansi::Paint;
painted.on_red();
Source§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
Source§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
Source§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
Source§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
Source§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
Source§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
Source§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
Source§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
Source§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
Source§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
Source§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling Attribute
value
.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold()
and
underline()
, which have the same functionality
but are pithier.
§Example
Make text bold using attr()
:
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);
Make text bold using using bold()
.
use yansi::Paint;
painted.bold();
Source§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
Source§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi
Quirk
value
.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask()
and
wrap()
, which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk()
:
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);
Enable wrapping using wrap()
.
use yansi::Paint;
painted.wrap();
Source§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting()
due to conflicts with Vec::clear()
.
The clear()
method will be removed in a future release.
fn clear(&self) -> Painted<&T>
resetting()
due to conflicts with Vec::clear()
.
The clear()
method will be removed in a future release.Source§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the Condition
value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted
only when both stdout
and stderr
are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string
, but without panic on OOM.