pub fn is_valid_arg(&self, sig: &SignatureToken) -> bool {
        match (sig, &self.0) {
            (SignatureToken::U8, ValueImpl::U8(_)) => true,
            (SignatureToken::U64, ValueImpl::U64(_)) => true,
            (SignatureToken::U128, ValueImpl::U128(_)) => true,
            (SignatureToken::Bool, ValueImpl::Bool(_)) => true,
            (SignatureToken::Address, ValueImpl::Address(_)) => true,
            (SignatureToken::Vector(ty), ValueImpl::Container(r)) => match (&**ty, &*r.borrow()) {
                (SignatureToken::Bool, Container::VecBool(_))
                | (SignatureToken::U8, Container::VecU8(_))
                | (SignatureToken::U64, Container::VecU64(_))
                | (SignatureToken::U128, Container::VecU128(_))
                | (SignatureToken::Address, Container::VecAddress(_)) => true,
                _ => false,
            },
            (
                SignatureToken::Reference(inner_ty),
                ValueImpl::ContainerRef(ContainerRef::Local(inner_ref)),
            ) => match (&**inner_ty, &*inner_ref.borrow()) {
                (SignatureToken::Signer, Container::StructR(v)) => {
                    v.len() == 1 && matches!(&v[0], ValueImpl::Address(_))
                }
                _ => true,
            },
            _ => false,
        }
    }
// REVIEW: this allows primitive (including `Signer`) and vectors of them. Vectors can only
// be one level (a different organization of `ValueImpl` could give us that property in an
// efficient way). Conceptually if we serialize the value and deserialize according to
// the argument type we would have accomplished a proper check (reference handling aside...)
this allows primitive (including `Signer`) and vectors of them. Vectors can only
be one level (a different organization of `ValueImpl` could give us that property in an
efficient way). Conceptually if we serialize the value and deserialize according to
the argument type we would have accomplished a proper check (reference handling aside...)
this allows primitive ( including ` Signer ` ) and vectors of them . Vectors can only be one level ( a different organization of ` ValueImpl ` could give us that property in an efficient way ) . Conceptually if we serialize the value and deserialize according to the argument type we would have accomplished a proper check ( reference handling aside ... )
pub fn is_valid_arg(&self, sig: &SignatureToken) -> bool {
        match (sig, &self.0) {
            (SignatureToken::U8, ValueImpl::U8(_)) => true,
            (SignatureToken::U64, ValueImpl::U64(_)) => true,
            (SignatureToken::U128, ValueImpl::U128(_)) => true,
            (SignatureToken::Bool, ValueImpl::Bool(_)) => true,
            (SignatureToken::Address, ValueImpl::Address(_)) => true,
            (SignatureToken::Vector(ty), ValueImpl::Container(r)) => match (&**ty, &*r.borrow()) {
                (SignatureToken::Bool, Container::VecBool(_))
                | (SignatureToken::U8, Container::VecU8(_))
                | (SignatureToken::U64, Container::VecU64(_))
                | (SignatureToken::U128, Container::VecU128(_))
                | (SignatureToken::Address, Container::VecAddress(_)) => true,
                _ => false,
            },
            (
                SignatureToken::Reference(inner_ty),
                ValueImpl::ContainerRef(ContainerRef::Local(inner_ref)),
            ) => match (&**inner_ty, &*inner_ref.borrow()) {
                (SignatureToken::Signer, Container::StructR(v)) => {
                    v.len() == 1 && matches!(&v[0], ValueImpl::Address(_))
                }
                _ => true,
            },
            _ => false,
        }
    }
pub fn is_valid_arg ( & self , sig : & SignatureToken ) -> bool { match ( sig , & self . 0 ) { ( SignatureToken :: U8 , ValueImpl :: U8 ( _ ) ) => true , ( SignatureToken :: U64 , ValueImpl :: U64 ( _ ) ) => true , ( SignatureToken :: U128 , ValueImpl :: U128 ( _ ) ) => true , ( SignatureToken :: Bool , ValueImpl :: Bool ( _ ) ) => true , ( SignatureToken :: Address , ValueImpl :: Address ( _ ) ) => true , ( SignatureToken :: Vector ( ty ) , ValueImpl :: Container ( r ) ) => match ( & * * ty , & * r . borrow ( ) ) { ( SignatureToken :: Bool , Container :: VecBool ( _ ) ) | ( SignatureToken :: U8 , Container :: VecU8 ( _ ) ) | ( SignatureToken :: U64 , Container :: VecU64 ( _ ) ) | ( SignatureToken :: U128 , Container :: VecU128 ( _ ) ) | ( SignatureToken :: Address , Container :: VecAddress ( _ ) ) => true , _ => false , } , ( SignatureToken :: Reference ( inner_ty ) , ValueImpl :: ContainerRef ( ContainerRef :: Local ( inner_ref ) ) , ) => match ( & * * inner_ty , & * inner_ref . borrow ( ) ) { ( SignatureToken :: Signer , Container :: StructR ( v ) ) => { v . len ( ) == 1 && matches ! ( v [ 0 ] ValueImpl Address ( ) ) } _ => true , } , _ => false , } }
REVIEW: this allows primitive (including `Signer`) and vectors of them.
REVIEW : this allows primitive ( including ` Signer ` ) and vectors of them .
&self
sig
&SignatureToken
&self
sig
&SignatureToken