Issue
In the vec! macro implementation there is this rule:
($($x:expr),+ $(,)?) => (
$crate::__rust_force_expr!(<[_]>::into_vec(box [$($x),+]))
);
What exactly is that <[_]> in it?
Solution
Breaking down the specific parts of the syntax:
<T>::fis the syntax to explicitly callfassociated with a typeT. Usually justT::fis enough, but pedantically,::requires a path, which is why it is used here since[_]is not. The<...>allows any type to be used as a path. See Why do I need angle brackets in <$a> when implementing macro based on type?[T]is the type denoting a slice of typeT._used as a type is a placeholder or "wildcard". It is not a type itself, but serves to indicate that the type should be inferred. See What does it mean to instantiate a Rust generic with an underscore?
Answered By - kmdreko Answer Checked By - Senaida (PHPFixing Volunteer)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.