pub enum TObject {
Any,
Named(TNamedObject),
Enum(TEnum),
}Expand description
Represents a PHP object type, distinguishing between the generic object
and instances of specific named classes/interfaces/traits (which may include intersections).
Variants§
Any
Represents the generic object type, accepting any object instance.
Named(TNamedObject)
Represents an instance of a specific named class/interface/trait,
potentially with generic parameters and intersection types (&).
Enum(TEnum)
Represents a specific enum type (unit or backed).
Implementations§
Source§impl TObject
impl TObject
Sourcepub fn new_named(name: StringIdentifier) -> Self
pub fn new_named(name: StringIdentifier) -> Self
Creates a new Object representing a specific named object type (default flags).
Sourcepub fn new_named_this(name: StringIdentifier) -> Self
pub fn new_named_this(name: StringIdentifier) -> Self
Creates a new Object representing $this for a given class name.
Sourcepub fn new_enum(name: StringIdentifier) -> Self
pub fn new_enum(name: StringIdentifier) -> Self
Creates a new TObject representing an enum.
Sourcepub fn new_enum_case(name: StringIdentifier, case: StringIdentifier) -> Self
pub fn new_enum_case(name: StringIdentifier, case: StringIdentifier) -> Self
Creates a new TObject representing an enum case.
Sourcepub const fn is_named(&self) -> bool
pub const fn is_named(&self) -> bool
Checks if this represents a specific named object type (including intersections).
Sourcepub const fn get_named_object_type(&self) -> Option<&TNamedObject>
pub const fn get_named_object_type(&self) -> Option<&TNamedObject>
Returns a reference to the NamedObject data if this is a Named variant.
Sourcepub const fn get_named_object_type_mut(&mut self) -> Option<&mut TNamedObject>
pub const fn get_named_object_type_mut(&mut self) -> Option<&mut TNamedObject>
Returns a mutable reference to the NamedObject data if this is a Named variant.
Sourcepub const fn get_enum_type(&self) -> Option<&TEnum>
pub const fn get_enum_type(&self) -> Option<&TEnum>
Returns a reference to the Enum data if this is an Enum variant.
Sourcepub const fn get_enum_type_mut(&mut self) -> Option<&mut TEnum>
pub const fn get_enum_type_mut(&mut self) -> Option<&mut TEnum>
Returns a mutable reference to the Enum data if this is an Enum variant.
Sourcepub const fn get_name(&self) -> Option<&StringIdentifier>
pub const fn get_name(&self) -> Option<&StringIdentifier>
Returns the primary name identifier if this is a Named or Enum variant.
Sourcepub fn get_type_parameters(&self) -> Option<&[TUnion]>
pub fn get_type_parameters(&self) -> Option<&[TUnion]>
Returns the type parameters of the named object if it has any.
Sourcepub fn get_intersection_types(&self) -> Option<&[TAtomic]>
pub fn get_intersection_types(&self) -> Option<&[TAtomic]>
Returns a slice of the additional intersection types (&B&S) if this is a Named object type.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for TObject
impl<'de> Deserialize<'de> for TObject
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 Ord for TObject
impl Ord for TObject
Source§impl PartialOrd for TObject
impl PartialOrd for TObject
Source§impl TType for TObject
impl TType for TObject
Source§fn get_child_nodes<'a>(&'a self) -> Vec<TypeRef<'a>>
fn get_child_nodes<'a>(&'a self) -> Vec<TypeRef<'a>>
Source§fn can_be_intersected(&self) -> bool
fn can_be_intersected(&self) -> bool
&B&S).Source§fn get_intersection_types(&self) -> Option<&[TAtomic]>
fn get_intersection_types(&self) -> Option<&[TAtomic]>
&B&S), if any. Contains boxed atomic types.Source§fn get_intersection_types_mut(&mut self) -> Option<&mut Vec<TAtomic>>
fn get_intersection_types_mut(&mut self) -> Option<&mut Vec<TAtomic>>
&B&S), if any. Contains boxed atomic types.Source§fn has_intersection_types(&self) -> bool
fn has_intersection_types(&self) -> bool
Source§fn add_intersection_type(&mut self, intersection_type: TAtomic) -> bool
fn add_intersection_type(&mut self, intersection_type: TAtomic) -> bool
Source§fn get_id(&self, interner: Option<&ThreadedInterner>) -> String
fn get_id(&self, interner: Option<&ThreadedInterner>) -> String
Source§fn get_all_child_nodes<'a>(&'a self) -> Vec<TypeRef<'a>>
fn get_all_child_nodes<'a>(&'a self) -> Vec<TypeRef<'a>>
impl Eq for TObject
impl StructuralPartialEq for TObject
Auto Trait Implementations§
impl Freeze for TObject
impl RefUnwindSafe for TObject
impl Send for TObject
impl Sync for TObject
impl Unpin for TObject
impl UnwindSafe for TObject
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.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> 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);