Skip to content

Commit 3913c15

Browse files
Expose ENCODED_LEN consts used in public to_string returns (#119)
1 parent d626f04 commit 3913c15

2 files changed

Lines changed: 10 additions & 10 deletions

File tree

src/ed25519.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ impl Debug for PrivateKey {
4141
impl PrivateKey {
4242
pub(crate) const PAYLOAD_LEN: usize = 32;
4343
pub(crate) const BINARY_LEN: usize = binary_len(Self::PAYLOAD_LEN);
44-
pub(crate) const ENCODED_LEN: usize = encode_len(Self::BINARY_LEN);
44+
pub const ENCODED_LEN: usize = encode_len(Self::BINARY_LEN);
4545
const _ASSERTS: () = {
4646
assert!(Self::BINARY_LEN == 35);
4747
assert!(Self::ENCODED_LEN == 56);
@@ -204,7 +204,7 @@ impl Debug for PublicKey {
204204
impl PublicKey {
205205
pub(crate) const PAYLOAD_LEN: usize = 32;
206206
pub(crate) const BINARY_LEN: usize = binary_len(Self::PAYLOAD_LEN);
207-
pub(crate) const ENCODED_LEN: usize = encode_len(Self::BINARY_LEN);
207+
pub const ENCODED_LEN: usize = encode_len(Self::BINARY_LEN);
208208
const _ASSERTS: () = {
209209
assert!(Self::BINARY_LEN == 35);
210210
assert!(Self::ENCODED_LEN == 56);
@@ -308,7 +308,7 @@ impl Debug for MuxedAccount {
308308
impl MuxedAccount {
309309
pub(crate) const PAYLOAD_LEN: usize = 32 + 8; // ed25519 + id
310310
pub(crate) const BINARY_LEN: usize = binary_len(Self::PAYLOAD_LEN);
311-
pub(crate) const ENCODED_LEN: usize = encode_len(Self::BINARY_LEN);
311+
pub const ENCODED_LEN: usize = encode_len(Self::BINARY_LEN);
312312
const _ASSERTS: () = {
313313
assert!(Self::BINARY_LEN == 43);
314314
assert!(Self::ENCODED_LEN == 69);
@@ -433,7 +433,7 @@ impl SignedPayload {
433433
// Max payload: 32 ed25519 + 4 len + 64 inner payload = 100
434434
pub(crate) const MAX_PAYLOAD_LEN: usize = 32 + 4 + 64;
435435
pub(crate) const MAX_BINARY_LEN: usize = binary_len(Self::MAX_PAYLOAD_LEN);
436-
pub(crate) const MAX_ENCODED_LEN: usize = encode_len(Self::MAX_BINARY_LEN);
436+
pub const MAX_ENCODED_LEN: usize = encode_len(Self::MAX_BINARY_LEN);
437437
const MIN_INNER_PAYLOAD_LEN: usize = 1;
438438
const MAX_INNER_PAYLOAD_LEN: usize = 64;
439439
const MAX_INNER_PAYLOAD_LEN_U32: u32 = 64;

src/strkey.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ impl Strkey {
3636
// SignedPayload is the longest strkey type.
3737
const MAX_PAYLOAD_LEN: usize = ed25519::SignedPayload::MAX_PAYLOAD_LEN;
3838
const MAX_BINARY_LEN: usize = binary_len(Self::MAX_PAYLOAD_LEN);
39-
pub(crate) const MAX_ENCODED_LEN: usize = encode_len(Self::MAX_BINARY_LEN);
39+
pub const MAX_ENCODED_LEN: usize = encode_len(Self::MAX_BINARY_LEN);
4040
const _ASSERTS: () = {
4141
assert!(Self::MAX_PAYLOAD_LEN == 100);
4242
assert!(Self::MAX_BINARY_LEN == 103);
@@ -281,7 +281,7 @@ impl Debug for PreAuthTx {
281281
impl PreAuthTx {
282282
pub(crate) const PAYLOAD_LEN: usize = 32;
283283
pub(crate) const BINARY_LEN: usize = binary_len(Self::PAYLOAD_LEN);
284-
pub(crate) const ENCODED_LEN: usize = encode_len(Self::BINARY_LEN);
284+
pub const ENCODED_LEN: usize = encode_len(Self::BINARY_LEN);
285285
const _ASSERTS: () = {
286286
assert!(Self::BINARY_LEN == 35);
287287
assert!(Self::ENCODED_LEN == 56);
@@ -378,7 +378,7 @@ impl Debug for HashX {
378378
impl HashX {
379379
pub(crate) const PAYLOAD_LEN: usize = 32;
380380
pub(crate) const BINARY_LEN: usize = binary_len(Self::PAYLOAD_LEN);
381-
pub(crate) const ENCODED_LEN: usize = encode_len(Self::BINARY_LEN);
381+
pub const ENCODED_LEN: usize = encode_len(Self::BINARY_LEN);
382382
const _ASSERTS: () = {
383383
assert!(Self::BINARY_LEN == 35);
384384
assert!(Self::ENCODED_LEN == 56);
@@ -475,7 +475,7 @@ impl Debug for Contract {
475475
impl Contract {
476476
pub(crate) const PAYLOAD_LEN: usize = 32;
477477
pub(crate) const BINARY_LEN: usize = binary_len(Self::PAYLOAD_LEN);
478-
pub(crate) const ENCODED_LEN: usize = encode_len(Self::BINARY_LEN);
478+
pub const ENCODED_LEN: usize = encode_len(Self::BINARY_LEN);
479479
const _ASSERTS: () = {
480480
assert!(Self::BINARY_LEN == 35);
481481
assert!(Self::ENCODED_LEN == 56);
@@ -572,7 +572,7 @@ impl Debug for LiquidityPool {
572572
impl LiquidityPool {
573573
pub(crate) const PAYLOAD_LEN: usize = 32;
574574
pub(crate) const BINARY_LEN: usize = binary_len(Self::PAYLOAD_LEN);
575-
pub(crate) const ENCODED_LEN: usize = encode_len(Self::BINARY_LEN);
575+
pub const ENCODED_LEN: usize = encode_len(Self::BINARY_LEN);
576576
const _ASSERTS: () = {
577577
assert!(Self::BINARY_LEN == 35);
578578
assert!(Self::ENCODED_LEN == 56);
@@ -678,7 +678,7 @@ impl ClaimableBalance {
678678
// Payload: 1 version byte + 32 hash bytes = 33
679679
pub(crate) const PAYLOAD_LEN: usize = 1 + 32;
680680
pub(crate) const BINARY_LEN: usize = binary_len(Self::PAYLOAD_LEN);
681-
pub(crate) const ENCODED_LEN: usize = encode_len(Self::BINARY_LEN);
681+
pub const ENCODED_LEN: usize = encode_len(Self::BINARY_LEN);
682682
const _ASSERTS: () = {
683683
assert!(Self::PAYLOAD_LEN == 33);
684684
assert!(Self::BINARY_LEN == 36);

0 commit comments

Comments
 (0)