Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
parity
Mirrored projects
ink
Commits
322ee5fd
Unverified
Commit
322ee5fd
authored
Mar 03, 2020
by
Alexander Theißen
Committed by
GitHub
Mar 03, 2020
Browse files
Implement Debug for storage::BTreeMap (#339)
parent
9dd4f47d
Pipeline
#81270
passed with stages
in 9 minutes and 47 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
core/src/storage/collections/btree_map/impls.rs
View file @
322ee5fd
...
...
@@ -122,6 +122,7 @@ enum UnderflowResult {
/// `BTreeMap` standard library implementation. The Rust implementation
/// is in-memory, whereas this implementation uses the ink! storage
/// primitives (`SyncChunk`, etc.).
#[derive(Debug)]
#[cfg_attr(feature
=
"ink-generate-abi"
,
derive(Metadata))]
pub
struct
BTreeMap
<
K
,
V
>
{
/// Stores densely packed general BTreeMap information.
...
...
@@ -148,7 +149,7 @@ pub struct BTreeMap<K, V> {
/// for performance reasons so that they all reside in the same
/// storage entity. This allows implementations to perform less reads
/// and writes to the underlying contract storage.
#[derive(Encode,
Decode)]
#[derive(
Debug,
Encode,
Decode)]
#[cfg_attr(feature
=
"ink-generate-abi"
,
derive(Metadata))]
struct
BTreeMapHeader
{
/// The latest vacant node index.
...
...
@@ -1673,7 +1674,7 @@ enum InsertResult {
/// `.entry()` API. It contains a key/value pair.
/// - `InternalEntry` is used internally in our implementation. It is a storage
/// entity and contains a tree node with many key/value pair storage indices.
#[derive(Encode,
Decode)]
#[derive(
Debug,
Encode,
Decode)]
#[cfg_attr(feature
=
"ink-generate-abi"
,
derive(Metadata))]
enum
InternalEntry
<
K
,
V
>
{
/// A vacant entry pointing to the next vacant index.
...
...
@@ -1708,7 +1709,7 @@ where
/// `.entry()` API. It contains a key/value pair.
/// - `InternalEntry` is used internally in our implementation. It is a storage
/// entity and contains a tree node with many key/value pairs.
#[derive(Encode,
Decode)]
#[derive(
Debug,
Encode,
Decode)]
#[cfg_attr(feature
=
"ink-generate-abi"
,
derive(Metadata))]
enum
InternalKVEntry
<
K
,
V
>
{
/// A vacant entry pointing to the next vacant index.
...
...
core/src/storage/collections/btree_map/node.rs
View file @
322ee5fd
...
...
@@ -38,7 +38,7 @@ use type_metadata::Metadata;
const
EDGES
:
usize
=
2
*
B
;
/// Reference to a key/value pair in the tree.
#[derive(Encode,
Decode)]
#[derive(
Debug,
Encode,
Decode)]
#[cfg_attr(feature
=
"ink-generate-abi"
,
derive(Metadata))]
pub
(
super
)
struct
KVPair
<
K
,
V
>
{
/// A key.
...
...
@@ -128,7 +128,7 @@ impl<'a, K, V> KVRef<'a, K, V> {
/// Each node is stored as one storage entity. This reduces storage access,
/// since with each fetch the entire content of a node (all its elements, etc.)
/// are fetched.
#[derive(PartialEq,
Eq,
Encode,
Decode)]
#[derive(
Debug,
PartialEq,
Eq,
Encode,
Decode)]
#[cfg_attr(feature
=
"ink-generate-abi"
,
derive(Metadata))]
pub
(
super
)
struct
Node
<
K
,
V
>
{
/// A reference to this node's parent node.
...
...
@@ -324,7 +324,7 @@ impl<K, V> Node<K, V> {
}
/// Points to a node in the tree.
#[derive(Clone,
Copy,
Encode,
Decode,
PartialEq,
Eq)]
#[derive(
Debug,
Clone,
Copy,
Encode,
Decode,
PartialEq,
Eq)]
#[cfg_attr(feature
=
"ink-generate-abi"
,
derive(Metadata))]
pub
(
super
)
struct
NodeHandle
{
node
:
u32
,
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment