#[non_exhaustive]pub struct FunctionLikeParameterMetadata {
pub attributes: Vec<AttributeMetadata>,
pub name: VariableIdentifier,
pub type_declaration_metadata: Option<TypeMetadata>,
pub type_metadata: Option<TypeMetadata>,
pub out_type: Option<TypeMetadata>,
pub default_type: Option<TypeMetadata>,
pub span: Span,
pub name_span: Span,
pub flags: MetadataFlags,
}Expand description
Contains metadata associated with a single parameter within a function, method, or closure signature.
This captures details like the parameter’s name, type hint, attributes, default value, pass-by-reference status, variadic nature, and other PHP features like property promotion.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.attributes: Vec<AttributeMetadata>Attributes attached to the parameter declaration.
name: VariableIdentifierThe identifier (name) of the parameter, including the leading ‘$’.
type_declaration_metadata: Option<TypeMetadata>The native type declaration from the function signature.
This is the type hint specified in the code (e.g., string $name), not from docblocks.
Can be None if no type hint is specified in the signature.
type_metadata: Option<TypeMetadata>The explicit type declaration (type hint) or docblock type (@param).
If there’s a docblock @param annotation, this will contain that type (with from_docblock=true).
Otherwise, this will be the same as type_declaration_metadata.
Can be None if no type is specified.
out_type: Option<TypeMetadata>The type specified by a @param-out docblock tag.
This indicates the expected type of a pass-by-reference parameter after the function executes.
default_type: Option<TypeMetadata>The inferred type of the parameter’s default value, if has_default is true and the
type could be determined.
None if there is no default or the default value’s type couldn’t be inferred.
span: SpanThe source code location (span) covering the entire parameter declaration.
name_span: SpanThe specific source code location (span) of the parameter’s name identifier.
flags: MetadataFlagsFlags indicating various properties of the parameter.
Implementations§
Source§impl FunctionLikeParameterMetadata
Contains metadata associated with a single parameter within a function, method, or closure signature.
impl FunctionLikeParameterMetadata
Contains metadata associated with a single parameter within a function, method, or closure signature.
This captures details like the parameter’s name, type hint, attributes, default value, pass-by-reference status, variadic nature, and other PHP features like property promotion.
Sourcepub fn new(
name: VariableIdentifier,
span: Span,
name_span: Span,
flags: MetadataFlags,
) -> Self
pub fn new( name: VariableIdentifier, span: Span, name_span: Span, flags: MetadataFlags, ) -> Self
Creates new FunctionLikeParameterMetadata for a basic parameter.
Initializes most flags to false and optional fields to None.
§Arguments
name: The identifier (name) of the parameter (e.g.,$userId).span: The source code location covering the entire parameter declaration.name_span: The source code location of the parameter’s name identifier ($userId).
Sourcepub fn get_name(&self) -> &VariableIdentifier
pub fn get_name(&self) -> &VariableIdentifier
Returns a reference to the parameter’s name identifier (e.g., $userId).
Sourcepub fn get_name_span(&self) -> Span
pub fn get_name_span(&self) -> Span
Returns the span covering the parameter’s name identifier.
Sourcepub fn get_type_metadata(&self) -> Option<&TypeMetadata>
pub fn get_type_metadata(&self) -> Option<&TypeMetadata>
Returns a reference to the parameter’s type metadata (effective type with docblock).
Sourcepub fn get_type_declaration_metadata(&self) -> Option<&TypeMetadata>
pub fn get_type_declaration_metadata(&self) -> Option<&TypeMetadata>
Returns a reference to the parameter’s native type declaration metadata.
Sourcepub fn get_default_type(&self) -> Option<&TypeMetadata>
pub fn get_default_type(&self) -> Option<&TypeMetadata>
Returns a reference to the inferred type of the default value, if known.
Sourcepub fn set_attributes(
&mut self,
attributes: impl IntoIterator<Item = AttributeMetadata>,
)
pub fn set_attributes( &mut self, attributes: impl IntoIterator<Item = AttributeMetadata>, )
Sets the attributes, replacing any existing ones.
Sourcepub fn with_attributes(
self,
attributes: impl IntoIterator<Item = AttributeMetadata>,
) -> Self
pub fn with_attributes( self, attributes: impl IntoIterator<Item = AttributeMetadata>, ) -> Self
Returns a new instance with the attributes replaced.
Sourcepub fn set_type_metadata(&mut self, type_metadata: Option<TypeMetadata>)
pub fn set_type_metadata(&mut self, type_metadata: Option<TypeMetadata>)
Sets the parameter’s type metadata (effective type with docblock).
Sourcepub fn set_type_declaration_metadata(
&mut self,
type_declaration: Option<TypeMetadata>,
)
pub fn set_type_declaration_metadata( &mut self, type_declaration: Option<TypeMetadata>, )
Sets the parameter’s native type declaration metadata.
If type_metadata is not set, it will be initialized with the same value.
Trait Implementations§
Source§impl Clone for FunctionLikeParameterMetadata
impl Clone for FunctionLikeParameterMetadata
Source§fn clone(&self) -> FunctionLikeParameterMetadata
fn clone(&self) -> FunctionLikeParameterMetadata
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<'de> Deserialize<'de> for FunctionLikeParameterMetadata
impl<'de> Deserialize<'de> for FunctionLikeParameterMetadata
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 HasSpan for FunctionLikeParameterMetadata
impl HasSpan for FunctionLikeParameterMetadata
Source§fn start_position(&self) -> Position
fn start_position(&self) -> Position
Source§fn start_offset(&self) -> u32
fn start_offset(&self) -> u32
Source§fn end_position(&self) -> Position
fn end_position(&self) -> Position
Source§fn end_offset(&self) -> u32
fn end_offset(&self) -> u32
Source§impl Hash for FunctionLikeParameterMetadata
impl Hash for FunctionLikeParameterMetadata
Source§impl PartialEq for FunctionLikeParameterMetadata
impl PartialEq for FunctionLikeParameterMetadata
Source§fn eq(&self, other: &FunctionLikeParameterMetadata) -> bool
fn eq(&self, other: &FunctionLikeParameterMetadata) -> bool
self and other values to be equal, and is used by ==.impl Eq for FunctionLikeParameterMetadata
impl StructuralPartialEq for FunctionLikeParameterMetadata
Auto Trait Implementations§
impl Freeze for FunctionLikeParameterMetadata
impl RefUnwindSafe for FunctionLikeParameterMetadata
impl Send for FunctionLikeParameterMetadata
impl Sync for FunctionLikeParameterMetadata
impl Unpin for FunctionLikeParameterMetadata
impl UnwindSafe for FunctionLikeParameterMetadata
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> 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> HasPosition for Twhere
T: HasSpan,
impl<T> HasPosition for Twhere
T: HasSpan,
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);