Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] doc binary-sv2 #1231

Draft
wants to merge 14 commits into
base: main
Choose a base branch
from
Draft

Conversation

Shourya742
Copy link
Contributor

@Shourya742 Shourya742 commented Oct 21, 2024

Closes: #1008 , #1009 , #1010

Copy link

codecov bot commented Oct 21, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 19.36%. Comparing base (b8e7715) to head (11db59f).
Report is 6 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1231   +/-   ##
=======================================
  Coverage   19.36%   19.36%           
=======================================
  Files         164      164           
  Lines       10811    10811           
=======================================
  Hits         2094     2094           
  Misses       8717     8717           
Flag Coverage Δ
binary_codec_sv2-coverage 0.00% <ø> (ø)
binary_serde_sv2-coverage 3.65% <ø> (ø)
binary_sv2-coverage 5.48% <ø> (+0.01%) ⬆️
bip32_derivation-coverage 0.00% <ø> (ø)
buffer_sv2-coverage 25.02% <ø> (ø)
codec_sv2-coverage 0.01% <ø> (ø)
common_messages_sv2-coverage 0.13% <ø> (ø)
const_sv2-coverage 0.00% <ø> (ø)
error_handling-coverage 0.00% <ø> (ø)
framing_sv2-coverage 0.29% <ø> (ø)
jd_client-coverage 0.00% <ø> (ø)
jd_server-coverage 8.13% <ø> (ø)
job_declaration_sv2-coverage 0.00% <ø> (ø)
key-utils-coverage 2.39% <ø> (ø)
mining-coverage 2.51% <ø> (ø)
mining_device-coverage 0.00% <ø> (ø)
mining_proxy_sv2-coverage 0.70% <ø> (ø)
noise_sv2-coverage 4.35% <ø> (ø)
pool_sv2-coverage 1.38% <ø> (ø)
protocols 24.72% <ø> (ø)
roles 6.63% <ø> (ø)
roles_logic_sv2-coverage 8.08% <ø> (+0.01%) ⬆️
sv1-mining-device-coverage 0.00% <ø> (ø)
sv2_ffi-coverage 0.00% <ø> (ø)
template_distribution_sv2-coverage 0.00% <ø> (ø)
translator_sv2-coverage 9.61% <ø> (ø)
utils 25.13% <ø> (ø)
v1-coverage 2.47% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@GitGab19
Copy link
Collaborator

@Shourya742 I think you mentioned the wrong issues in the description

@Shourya742 Shourya742 changed the title doc binary-sv2 [WIP] doc binary-sv2 Oct 22, 2024
@Shourya742
Copy link
Contributor Author

@Shourya742 I think you mentioned the wrong issues in the description

Thanks for pointing it out... Now pointing to correct issues..

Copy link
Contributor

🐰 Bencher Report

Branchdoc-binary-sv2
Testbedsv1
Click to view all benchmark results
BenchmarkLatencyBenchmark Result
nanoseconds (ns)
(Result Δ%)
Upper Boundary
nanoseconds (ns)
(Limit %)
client-submit-serialize📈 view plot
🚷 view threshold
6,682.30
(-1.85%)
7,726.18
(86.49%)
client-submit-serialize-deserialize📈 view plot
🚷 view threshold
7,610.30
(-2.23%)
8,772.29
(86.75%)
client-submit-serialize-deserialize-handle/client-submit-serialize-deserialize-handle📈 view plot
🚷 view threshold
8,208.00
(-1.72%)
9,359.54
(87.70%)
client-sv1-authorize-serialize-deserialize-handle/client-sv1-authorize-serialize-deserialize-handle📈 view plot
🚷 view threshold
857.57
(-6.30%)
1,079.45
(79.44%)
client-sv1-authorize-serialize-deserialize/client-sv1-authorize-serialize-deserialize📈 view plot
🚷 view threshold
662.57
(-6.98%)
865.76
(76.53%)
client-sv1-authorize-serialize/client-sv1-authorize-serialize📈 view plot
🚷 view threshold
246.26
(-0.86%)
263.79
(93.35%)
client-sv1-get-authorize/client-sv1-get-authorize📈 view plot
🚷 view threshold
157.44
(-0.09%)
162.32
(96.99%)
client-sv1-get-submit📈 view plot
🚷 view threshold
6,507.10
(-1.19%)
7,520.98
(86.52%)
client-sv1-get-subscribe/client-sv1-get-subscribe📈 view plot
🚷 view threshold
281.06
(+0.34%)
316.34
(88.85%)
client-sv1-subscribe-serialize-deserialize-handle/client-sv1-subscribe-serialize-deserialize-handle📈 view plot
🚷 view threshold
716.75
(-7.32%)
910.42
(78.73%)
client-sv1-subscribe-serialize-deserialize/client-sv1-subscribe-serialize-deserialize📈 view plot
🚷 view threshold
588.06
(-6.29%)
740.52
(79.41%)
client-sv1-subscribe-serialize/client-sv1-subscribe-serialize📈 view plot
🚷 view threshold
211.43
(+3.17%)
222.55
(95.00%)
🐰 View full continuous benchmarking report in Bencher

Copy link
Contributor

🐰 Bencher Report

Branchdoc-binary-sv2
Testbedsv2
Click to view all benchmark results
BenchmarkEstimated CyclesBenchmark Result
estimated cycles
(Result Δ%)
Upper Boundary
estimated cycles
(Limit %)
InstructionsBenchmark Result
instructions
(Result Δ%)
Upper Boundary
instructions
(Limit %)
L1 AccessesBenchmark Result
accesses
(Result Δ%)
Upper Boundary
accesses
(Limit %)
L2 AccessesBenchmark Result
accesses
(Result Δ%)
Upper Boundary
accesses
(Limit %)
RAM AccessesBenchmark Result
accesses
(Result Δ%)
Upper Boundary
accesses
(Limit %)
client_sv2_handle_message_common📈 view plot
🚷 view threshold
2,065.00
(-1.27%)
2,203.17
(93.73%)
📈 view plot
🚷 view threshold
473.00
(-0.10%)
490.80
(96.37%)
📈 view plot
🚷 view threshold
735.00
(-0.14%)
760.98
(96.59%)
📈 view plot
🚷 view threshold
7.00
(+26.02%)
14.28
(49.00%)
📈 view plot
🚷 view threshold
37.00
(-2.47%)
41.06
(90.11%)
client_sv2_handle_message_mining📈 view plot
🚷 view threshold
8,162.00
(-0.56%)
8,299.39
(98.34%)
📈 view plot
🚷 view threshold
2,137.00
(-0.03%)
2,143.08
(99.72%)
📈 view plot
🚷 view threshold
3,162.00
(+0.04%)
3,170.65
(99.73%)
📈 view plot
🚷 view threshold
34.00
(-4.81%)
42.70
(79.63%)
📈 view plot
🚷 view threshold
138.00
(-0.80%)
141.17
(97.76%)
client_sv2_mining_message_submit_standard📈 view plot
🚷 view threshold
6,221.00
(-0.93%)
6,385.19
(97.43%)
📈 view plot
🚷 view threshold
1,750.00
(-0.06%)
1,769.03
(98.92%)
📈 view plot
🚷 view threshold
2,551.00
(-0.12%)
2,579.93
(98.88%)
📈 view plot
🚷 view threshold
20.00
(+17.76%)
24.81
(80.60%)
📈 view plot
🚷 view threshold
102.00
(-1.93%)
106.95
(95.37%)
client_sv2_mining_message_submit_standard_serialize📈 view plot
🚷 view threshold
14,644.00
(-0.64%)
14,995.55
(97.66%)
📈 view plot
🚷 view threshold
4,694.00
(-0.02%)
4,713.03
(99.60%)
📈 view plot
🚷 view threshold
6,759.00
(+0.00%)
6,785.37
(99.61%)
📈 view plot
🚷 view threshold
44.00
(+1.04%)
53.43
(82.35%)
📈 view plot
🚷 view threshold
219.00
(-1.25%)
228.55
(95.82%)
client_sv2_mining_message_submit_standard_serialize_deserialize📈 view plot
🚷 view threshold
27,484.00
(-0.16%)
27,725.84
(99.13%)
📈 view plot
🚷 view threshold
10,585.00
(+0.08%)
10,634.68
(99.53%)
📈 view plot
🚷 view threshold
15,399.00
(+0.06%)
15,478.73
(99.48%)
📈 view plot
🚷 view threshold
86.00
(+5.91%)
89.40
(96.20%)
📈 view plot
🚷 view threshold
333.00
(-0.66%)
342.07
(97.35%)
client_sv2_open_channel📈 view plot
🚷 view threshold
4,299.00
(-2.36%)
4,632.73
(92.80%)
📈 view plot
🚷 view threshold
1,461.00
(-0.03%)
1,478.80
(98.80%)
📈 view plot
🚷 view threshold
2,164.00
(+0.20%)
2,187.55
(98.92%)
📈 view plot
🚷 view threshold
7.00
(-22.96%)
17.93
(39.03%)
📈 view plot
🚷 view threshold
60.00
(-4.45%)
68.90
(87.08%)
client_sv2_open_channel_serialize📈 view plot
🚷 view threshold
13,932.00
(-1.01%)
14,492.18
(96.13%)
📈 view plot
🚷 view threshold
5,064.00
(-0.01%)
5,081.80
(99.65%)
📈 view plot
🚷 view threshold
7,332.00
(+0.09%)
7,355.14
(99.69%)
📈 view plot
🚷 view threshold
32.00
(-8.73%)
43.08
(74.29%)
📈 view plot
🚷 view threshold
184.00
(-2.02%)
199.82
(92.08%)
client_sv2_open_channel_serialize_deserialize📈 view plot
🚷 view threshold
22,557.00
(-0.48%)
22,906.09
(98.48%)
📈 view plot
🚷 view threshold
8,027.00
(+0.11%)
8,075.00
(99.41%)
📈 view plot
🚷 view threshold
11,672.00
(+0.07%)
11,756.26
(99.28%)
📈 view plot
🚷 view threshold
84.00
(+13.37%)
84.62
(99.26%)
📈 view plot
🚷 view threshold
299.00
(-1.56%)
312.59
(95.65%)
client_sv2_setup_connection📈 view plot
🚷 view threshold
4,639.00
(-0.98%)
4,777.31
(97.10%)
📈 view plot
🚷 view threshold
1,502.00
(-0.03%)
1,519.80
(98.83%)
📈 view plot
🚷 view threshold
2,279.00
(+0.00%)
2,303.04
(98.96%)
📈 view plot
🚷 view threshold
10.00
(+9.22%)
15.53
(64.37%)
📈 view plot
🚷 view threshold
66.00
(-2.13%)
69.99
(94.30%)
client_sv2_setup_connection_serialize📈 view plot
🚷 view threshold
16,094.00
(-0.54%)
16,488.95
(97.60%)
📈 view plot
🚷 view threshold
5,963.00
(-0.01%)
5,980.80
(99.70%)
📈 view plot
🚷 view threshold
8,669.00
(+0.06%)
8,694.57
(99.71%)
📈 view plot
🚷 view threshold
36.00
(-10.21%)
53.66
(67.09%)
📈 view plot
🚷 view threshold
207.00
(-0.98%)
217.08
(95.35%)
client_sv2_setup_connection_serialize_deserialize📈 view plot
🚷 view threshold
35,526.00
(-0.07%)
35,735.71
(99.41%)
📈 view plot
🚷 view threshold
14,855.00
(+0.06%)
14,904.04
(99.67%)
📈 view plot
🚷 view threshold
21,821.00
(+0.06%)
21,913.94
(99.58%)
📈 view plot
🚷 view threshold
95.00
(+1.94%)
115.13
(82.52%)
📈 view plot
🚷 view threshold
378.00
(-0.36%)
384.76
(98.24%)
🐰 View full continuous benchmarking report in Bencher

Copy link
Contributor

🐰 Bencher Report

Branchdoc-binary-sv2
Testbedsv1
Click to view all benchmark results
BenchmarkEstimated CyclesBenchmark Result
estimated cycles
(Result Δ%)
Upper Boundary
estimated cycles
(Limit %)
InstructionsBenchmark Result
instructions
(Result Δ%)
Upper Boundary
instructions
(Limit %)
L1 AccessesBenchmark Result
accesses
(Result Δ%)
Upper Boundary
accesses
(Limit %)
L2 AccessesBenchmark Result
accesses
(Result Δ%)
Upper Boundary
accesses
(Limit %)
RAM AccessesBenchmark Result
accesses
(Result Δ%)
Upper Boundary
accesses
(Limit %)
get_authorize📈 view plot
🚷 view threshold
8,312.00
(-1.71%)
8,830.69
(94.13%)
📈 view plot
🚷 view threshold
3,663.00
(-2.30%)
3,890.21
(94.16%)
📈 view plot
🚷 view threshold
5,112.00
(-2.78%)
5,456.54
(93.69%)
📈 view plot
🚷 view threshold
10.00
(+41.44%)
12.11
(82.58%)
📈 view plot
🚷 view threshold
90.00
(-0.42%)
96.15
(93.60%)
get_submit📈 view plot
🚷 view threshold
95,206.00
(-0.25%)
96,159.09
(99.01%)
📈 view plot
🚷 view threshold
59,263.00
(-0.35%)
59,815.42
(99.08%)
📈 view plot
🚷 view threshold
85,081.00
(-0.40%)
85,913.62
(99.03%)
📈 view plot
🚷 view threshold
44.00
(-3.73%)
66.46
(66.20%)
📈 view plot
🚷 view threshold
283.00
(+1.14%)
289.10
(97.89%)
get_subscribe📈 view plot
🚷 view threshold
7,875.00
(-1.79%)
8,380.83
(93.96%)
📈 view plot
🚷 view threshold
2,758.00
(-2.75%)
2,968.67
(92.90%)
📈 view plot
🚷 view threshold
3,830.00
(-3.40%)
4,147.10
(92.35%)
📈 view plot
🚷 view threshold
18.00
(+48.55%)
21.27
(84.62%)
📈 view plot
🚷 view threshold
113.00
(-0.96%)
120.13
(94.06%)
serialize_authorize📈 view plot
🚷 view threshold
12,055.00
(-1.77%)
12,653.99
(95.27%)
📈 view plot
🚷 view threshold
5,240.00
(-1.51%)
5,460.61
(95.96%)
📈 view plot
🚷 view threshold
7,285.00
(-1.83%)
7,618.48
(95.62%)
📈 view plot
🚷 view threshold
9.00
(+0.96%)
14.92
(60.31%)
📈 view plot
🚷 view threshold
135.00
(-1.71%)
143.66
(93.97%)
serialize_deserialize_authorize📈 view plot
🚷 view threshold
24,428.00
(-1.03%)
25,279.56
(96.63%)
📈 view plot
🚷 view threshold
9,786.00
(-1.07%)
10,055.61
(97.32%)
📈 view plot
🚷 view threshold
13,793.00
(-1.23%)
14,210.37
(97.06%)
📈 view plot
🚷 view threshold
34.00
(-2.33%)
44.23
(76.87%)
📈 view plot
🚷 view threshold
299.00
(-0.75%)
315.92
(94.64%)
serialize_deserialize_handle_authorize📈 view plot
🚷 view threshold
30,201.00
(-0.38%)
30,794.11
(98.07%)
📈 view plot
🚷 view threshold
11,989.00
(-0.79%)
12,224.80
(98.07%)
📈 view plot
🚷 view threshold
16,951.00
(-0.94%)
17,315.73
(97.89%)
📈 view plot
🚷 view threshold
60.00
(+7.82%)
68.00
(88.23%)
📈 view plot
🚷 view threshold
370.00
(+0.18%)
382.24
(96.80%)
serialize_deserialize_handle_submit📈 view plot
🚷 view threshold
126,196.00
(-0.22%)
127,202.14
(99.21%)
📈 view plot
🚷 view threshold
73,117.00
(-0.24%)
73,700.07
(99.21%)
📈 view plot
🚷 view threshold
104,766.00
(-0.29%)
105,670.28
(99.14%)
📈 view plot
🚷 view threshold
114.00
(+5.62%)
136.20
(83.70%)
📈 view plot
🚷 view threshold
596.00
(-0.01%)
605.17
(98.49%)
serialize_deserialize_handle_subscribe📈 view plot
🚷 view threshold
27,753.00
(-0.26%)
28,651.98
(96.86%)
📈 view plot
🚷 view threshold
9,577.00
(-0.74%)
9,788.40
(97.84%)
📈 view plot
🚷 view threshold
13,523.00
(-0.92%)
13,846.88
(97.66%)
📈 view plot
🚷 view threshold
67.00
(+5.72%)
75.75
(88.45%)
📈 view plot
🚷 view threshold
397.00
(+0.26%)
417.51
(95.09%)
serialize_deserialize_submit📈 view plot
🚷 view threshold
114,839.00
(-0.35%)
116,000.94
(99.00%)
📈 view plot
🚷 view threshold
67,894.00
(-0.31%)
68,517.20
(99.09%)
📈 view plot
🚷 view threshold
97,374.00
(-0.37%)
98,362.73
(98.99%)
📈 view plot
🚷 view threshold
63.00
(-0.02%)
79.20
(79.55%)
📈 view plot
🚷 view threshold
490.00
(-0.19%)
499.71
(98.06%)
serialize_deserialize_subscribe📈 view plot
🚷 view threshold
23,040.00
(-0.87%)
24,078.61
(95.69%)
📈 view plot
🚷 view threshold
8,129.00
(-0.91%)
8,345.48
(97.41%)
📈 view plot
🚷 view threshold
11,430.00
(-1.09%)
11,755.83
(97.23%)
📈 view plot
🚷 view threshold
40.00
(+6.96%)
44.72
(89.45%)
📈 view plot
🚷 view threshold
326.00
(-0.78%)
349.43
(93.29%)
serialize_submit📈 view plot
🚷 view threshold
99,519.00
(-0.34%)
100,529.02
(99.00%)
📈 view plot
🚷 view threshold
61,325.00
(-0.31%)
61,861.99
(99.13%)
📈 view plot
🚷 view threshold
87,944.00
(-0.36%)
88,762.59
(99.08%)
📈 view plot
🚷 view threshold
47.00
(-0.55%)
66.31
(70.88%)
📈 view plot
🚷 view threshold
324.00
(-0.13%)
333.64
(97.11%)
serialize_subscribe📈 view plot
🚷 view threshold
11,206.00
(-1.67%)
11,763.36
(95.26%)
📈 view plot
🚷 view threshold
4,111.00
(-1.72%)
4,315.12
(95.27%)
📈 view plot
🚷 view threshold
5,696.00
(-2.16%)
6,003.15
(94.88%)
📈 view plot
🚷 view threshold
17.00
(+31.80%)
20.85
(81.52%)
📈 view plot
🚷 view threshold
155.00
(-1.55%)
164.13
(94.44%)
🐰 View full continuous benchmarking report in Bencher

Copy link
Contributor

🐰 Bencher Report

Branchdoc-binary-sv2
Testbedsv2
Click to view all benchmark results
BenchmarkLatencyBenchmark Result
nanoseconds (ns)
(Result Δ%)
Upper Boundary
nanoseconds (ns)
(Limit %)
client_sv2_handle_message_common📈 view plot
🚷 view threshold
44.68
(+0.32%)
46.93
(95.19%)
client_sv2_handle_message_mining📈 view plot
🚷 view threshold
72.82
(-3.95%)
94.70
(76.89%)
client_sv2_mining_message_submit_standard📈 view plot
🚷 view threshold
14.69
(+0.25%)
14.76
(99.58%)
client_sv2_mining_message_submit_standard_serialize📈 view plot
🚷 view threshold
273.15
(+2.95%)
300.12
(91.01%)
client_sv2_mining_message_submit_standard_serialize_deserialize📈 view plot
🚷 view threshold
611.86
(+3.13%)
663.82
(92.17%)
client_sv2_open_channel📈 view plot
🚷 view threshold
148.18
(-6.30%)
205.97
(71.94%)
client_sv2_open_channel_serialize📈 view plot
🚷 view threshold
287.30
(+3.52%)
321.86
(89.26%)
client_sv2_open_channel_serialize_deserialize📈 view plot
🚷 view threshold
371.74
(-1.42%)
409.64
(90.75%)
client_sv2_setup_connection📈 view plot
🚷 view threshold
161.30
(+0.40%)
174.40
(92.49%)
client_sv2_setup_connection_serialize📈 view plot
🚷 view threshold
464.23
(+1.70%)
577.81
(80.34%)
client_sv2_setup_connection_serialize_deserialize📈 view plot
🚷 view threshold
1,015.90
(+2.06%)
1,143.23
(88.86%)
🐰 View full continuous benchmarking report in Bencher

@stratum-mining stratum-mining deleted a comment from github-actions bot Nov 12, 2024
@stratum-mining stratum-mining deleted a comment from github-actions bot Nov 12, 2024
@stratum-mining stratum-mining deleted a comment from github-actions bot Nov 12, 2024
@stratum-mining stratum-mining deleted a comment from github-actions bot Nov 12, 2024
Copy link
Collaborator

@rrybarczyk rrybarczyk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is the first chunk of a review.

Some of the changes I suggested in decodable.rs can be extrapolated to other files. Specifically we need to avoid language like "This method", "This implementation", etc. and just directly say what it is (the language does not really need to change beyond the removal of the qualifiers). Also, we need to make sure each line goes up to 100 characters.

Do we have examples to add?

@@ -10,13 +10,35 @@ use std::convert::TryFrom;
#[cfg(not(feature = "no_std"))]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need top level comments here with a header title and an explainer of what the module is/does.

@@ -1,3 +1,64 @@
// This module provides an encoding framework for serializing various data types into bytes.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need top level comments here with a header title and an explainer of what the module is/does.

Comment on lines +13 to +23
/// Trait that defines how a type can be decoded from raw byte data.
///
/// This trait describes the process of decoding a data structure from a sequence of bytes.
/// Implementations use a combination of methods to extract the structure of the data, decode its
/// fields, and then construct the type from those decoded fields. It is designed to handle both
/// simple types and nested or complex data structures.
///
/// - `get_structure`: Describes the layout of the type's fields, allowing the decoder to break down the raw data.
/// - `from_decoded_fields`: Reconstructs the type from individual decoded fields.
/// - `from_bytes`: High-level method that manages the decoding process from raw bytes.
/// - `from_reader`: Reads and decodes data from a stream, useful when working with I/O sources like files or network sockets.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need to re-describe each method.

Suggested change
/// Trait that defines how a type can be decoded from raw byte data.
///
/// This trait describes the process of decoding a data structure from a sequence of bytes.
/// Implementations use a combination of methods to extract the structure of the data, decode its
/// fields, and then construct the type from those decoded fields. It is designed to handle both
/// simple types and nested or complex data structures.
///
/// - `get_structure`: Describes the layout of the type's fields, allowing the decoder to break down the raw data.
/// - `from_decoded_fields`: Reconstructs the type from individual decoded fields.
/// - `from_bytes`: High-level method that manages the decoding process from raw bytes.
/// - `from_reader`: Reads and decodes data from a stream, useful when working with I/O sources like files or network sockets.
/// Custom deserialization of types from binary data.
///
/// Defines the process of reconstructing a type from a sequence of bytes. It handles both simple
/// and nested or complex data structures.

fn get_structure(data: &[u8]) -> Result<Vec<FieldMarker>, Error>;

/// Constructs the type from decoded fields.
///
/// After the data has been split into fields, this method combines those fields
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extend the comment to 100 character line length

Comment on lines +25 to +28
/// Returns the structure of the type.
///
/// This method defines the layout of the data fields within the type. The structure
/// returned is used to split raw data into individual fields that can be decoded.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// Returns the structure of the type.
///
/// This method defines the layout of the data fields within the type. The structure
/// returned is used to split raw data into individual fields that can be decoded.
/// Defines the expected structure of a type in terms of individual fields, based on binary
/// data.
///
/// This function returns a vector of `FieldMarker`s, each representing a component of the
/// structure. Useful for guiding the decoding process.

Primitive(DecodablePrimitive<'a>),
/// Represents vector of DecodableField
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// Represents vector of DecodableField
/// Structured field, allowing for nested data structures.

//
// This implementation defines how to estimate the size of data represented by a `PrimitiveMarker`.
// This is useful for efficient decoding, allowing the decoder to correctly split raw data into
// fields of the right size.
impl SizeHint for PrimitiveMarker {
// PrimitiveMarker need introspection to return a size hint. This method is not implementeable
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// PrimitiveMarker need introspection to return a size hint. This method is not implementeable
// PrimitiveMarker needs introspection to return a size hint. This method is not implementable.

Struct(Vec<DecodableField<'a>>),
}

// Provides size hinting for each primitive marker.
//
// This implementation defines how to estimate the size of data represented by a `PrimitiveMarker`.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rm "This implementation"

@@ -135,6 +192,10 @@ impl SizeHint for PrimitiveMarker {
}
}

// Provides size hinting for each field marker, including nested structures.
//
// This method defines how to estimate the size of a field, whether it's a primitive or a
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rm "This method"

// Implements the decoding process for a `PrimitiveMarker`.
// Given a slice of data and an offset, this method parses the corresponding data and returns
// a `DecodablePrimitive`. This is the core mechanism for decoding primitive types like integers,
// booleans, and fixed-length byte arrays from raw byte data.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// booleans, and fixed-length byte arrays from raw byte data.
// Booleans, and fixed-length byte arrays from raw byte data.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants