pub trait IntoFrpNodeAny {
fn into_rc_any(self: Rc<Self>) -> Rc<FrpNodeAny>;
}
In the code above, we see a type signature on self
. What is this feature called and where is it documented?
pub trait IntoFrpNodeAny {
fn into_rc_any(self: Rc<Self>) -> Rc<FrpNodeAny>;
}
In the code above, we see a type signature on self
. What is this feature called and where is it documented?
You can actually have a type signature on self
, since it is just another method parameter. The type of self
is, without the feature @OptimisticPeach linked, limited to a specific list though (since it is hard to do method resolution in the more general case):
Self
&Self
&mut Self
Box<Self>
Rc<Self>
Arc<Self>
Pin<P>
where P
is any if the above except Self
The usual ways of writing self
parameters (self
, &self
and &mut self
) are just syntactic sugar for the corresponding type annotations in the most common cases.
@jameseb7 : Thanks for the explicit list. This explains why
self: Rc<...>
compiled fine
self: RcByLoc<..>
was giving me some weird resolution error (where RcByLoc
is a custom class I wrote).
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.