You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fnfoo((x, y, z):(int,int,int)) -> int{
x * y * z
}assert_eq!(foo((1,2,3)),6)
But there is no way of destructuring the self argument in methods. I don't know what kind of syntax this would involve, but the following sample shows a possibility:
traitFoo{fnfoo(&self) -> int;}implFoofor(int,int,int){fnfoo(&self @ &(x,y,z)) -> int{
x * y * z
}}assert_eq!((1i,2i,3i).foo(),6);
The text was updated successfully, but these errors were encountered:
Currently we can destructure function arguments:
But there is no way of destructuring the
self
argument in methods. I don't know what kind of syntax this would involve, but the following sample shows a possibility:The text was updated successfully, but these errors were encountered: