-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7bf74c7
commit 8863de4
Showing
9 changed files
with
564 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/// The contract defines an interface for serialization strategies that can be used to serialize the struct or resource | ||
/// according to a specific format. | ||
/// | ||
access(all) contract SerializationInterfaces { | ||
|
||
/// A SerializationStrategy takes a reference to a SerializableResource or SerializableStruct and returns a | ||
/// serialized representation of it. The strategy is responsible for determining the structure of the serialized | ||
/// representation and the format of the serialized data. | ||
/// | ||
access(all) | ||
struct interface SerializationStrategy { | ||
/// Returns the types supported by the implementing strategy | ||
/// | ||
access(all) view fun getSupportedTypes(): [Type] { | ||
return [] | ||
} | ||
|
||
/// Returns serialized representation of the given resource according to the format of the implementing strategy | ||
/// | ||
access(all) fun serializeResource(_ r: &AnyResource): String? { | ||
return nil | ||
} | ||
|
||
/// Returns serialized representation of the given struct according to the format of the implementing strategy | ||
/// | ||
access(all) fun serializeStruct(_ s: AnyStruct): String? { | ||
return nil | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.