pub enum Value {
String(String),
Bytes(Vec<u8>),
Array(Vec<Value>),
Struct(Struct),
Bool(bool),
Integer(i64),
}Expand description
EIP-712 values, JSON-compatible
Variants§
Implementations§
Source§impl Value
impl Value
pub fn as_bytes(&self) -> Result<Option<Vec<u8>>, TypedDataHashError>
Sourcepub fn encode(
&self,
type_: &TypeRef,
types: &Types,
) -> Result<Vec<u8>, TypedDataHashError>
pub fn encode( &self, type_: &TypeRef, types: &Types, ) -> Result<Vec<u8>, TypedDataHashError>
Encode the value into a byte string according to the EIP-712
encodeData function.
Note: this implementation follows eth-sig-util which diverges from EIP-712 when encoding arrays.
Source§impl Value
impl Value
Sourcepub fn hash(
&self,
struct_name: &StructName,
types: &Types,
) -> Result<[u8; 32], TypedDataHashError>
pub fn hash( &self, struct_name: &StructName, types: &Types, ) -> Result<[u8; 32], TypedDataHashError>
Hash the value.
See: https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Value
impl<'de> Deserialize<'de> for Value
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>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl<V: Vocabulary, I: Interpretation> LinkedData<I, V> for Value
impl<V: Vocabulary, I: Interpretation> LinkedData<I, V> for Value
Source§impl<V, I> LinkedDataDeserializePredicateObjects<I, V> for Valuewhere
V: Vocabulary,
I: ReverseIriInterpretation<Iri = V::Iri> + ReverseLiteralInterpretation<Literal = V::Literal> + Interpretation,
impl<V, I> LinkedDataDeserializePredicateObjects<I, V> for Valuewhere
V: Vocabulary,
I: ReverseIriInterpretation<Iri = V::Iri> + ReverseLiteralInterpretation<Literal = V::Literal> + Interpretation,
fn deserialize_objects_in<'a, D>( vocabulary: &V, interpretation: &I, dataset: &D, graph: Option<&I::Resource>, objects: impl IntoIterator<Item = &'a I::Resource>, context: Context<'_, I>, ) -> Result<Self, FromLinkedDataError>
fn deserialize_objects<'a, D>(
vocabulary: &V,
interpretation: &I,
dataset: &D,
graph: Option<&<I as Interpretation>::Resource>,
objects: impl IntoIterator<Item = &'a <I as Interpretation>::Resource>,
) -> Result<Self, FromLinkedDataError>where
<I as Interpretation>::Resource: 'a,
D: PatternMatchingDataset<Resource = <I as Interpretation>::Resource>,
Source§impl<V, I> LinkedDataDeserializeSubject<I, V> for Valuewhere
V: Vocabulary,
I: ReverseIriInterpretation<Iri = V::Iri> + ReverseLiteralInterpretation<Literal = V::Literal> + Interpretation,
impl<V, I> LinkedDataDeserializeSubject<I, V> for Valuewhere
V: Vocabulary,
I: ReverseIriInterpretation<Iri = V::Iri> + ReverseLiteralInterpretation<Literal = V::Literal> + Interpretation,
fn deserialize_subject_in<D>(
vocabulary: &V,
interpretation: &I,
_dataset: &D,
_graph: Option<&I::Resource>,
resource: &I::Resource,
context: Context<'_, I>,
) -> Result<Self, FromLinkedDataError>where
D: PatternMatchingDataset<Resource = I::Resource>,
fn deserialize_subject<D>( vocabulary: &V, interpretation: &I, dataset: &D, graph: Option<&<I as Interpretation>::Resource>, resource: &<I as Interpretation>::Resource, ) -> Result<Self, FromLinkedDataError>
Source§impl<V: Vocabulary, I: Interpretation> LinkedDataGraph<I, V> for Value
impl<V: Vocabulary, I: Interpretation> LinkedDataGraph<I, V> for Value
fn visit_graph<S>(&self, visitor: S) -> Result<S::Ok, S::Error>where
S: GraphVisitor<I, V>,
Source§impl<V: Vocabulary, I: Interpretation> LinkedDataPredicateObjects<I, V> for Value
impl<V: Vocabulary, I: Interpretation> LinkedDataPredicateObjects<I, V> for Value
fn visit_objects<S>(&self, visitor: S) -> Result<S::Ok, S::Error>where
S: PredicateObjectsVisitor<I, V>,
Source§impl<V: Vocabulary, I: Interpretation> LinkedDataResource<I, V> for Value
impl<V: Vocabulary, I: Interpretation> LinkedDataResource<I, V> for Value
fn interpretation( &self, _vocabulary: &mut V, _interpretation: &mut I, ) -> ResourceInterpretation<'_, I, V>
fn lexical_representation<'a>(
&'a self,
vocabulary: &'a mut V,
interpretation: &'a mut I,
) -> Option<CowRdfTerm<'a, V>>where
I: ReverseTermInterpretation<Iri = <V as IriVocabulary>::Iri, BlankId = <V as BlankIdVocabulary>::BlankId, Literal = <V as LiteralVocabulary>::Literal>,
fn reference_interpretation( &self, vocabulary: &mut V, interpretation: &mut I, ) -> ResourceInterpretation<'_, I, V>
Source§impl<V: Vocabulary, I: Interpretation> LinkedDataSubject<I, V> for Value
impl<V: Vocabulary, I: Interpretation> LinkedDataSubject<I, V> for Value
fn visit_subject<S>(&self, visitor: S) -> Result<S::Ok, S::Error>where
S: SubjectVisitor<I, V>,
impl Eq for Value
impl StructuralPartialEq for Value
Auto Trait Implementations§
impl Freeze for Value
impl RefUnwindSafe for Value
impl Send for Value
impl Sync for Value
impl Unpin for Value
impl UnwindSafe for Value
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
Mutably borrows from an owned value. Read more
Source§impl<T> BorrowUnordered for T
impl<T> BorrowUnordered for T
fn as_unordered(&self) -> &Unordered<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
Compare self to
key and return true if they are equal.