Skip to content

Commit

Permalink
chore: modify to pub (#119)
Browse files Browse the repository at this point in the history
  • Loading branch information
varovainen authored Oct 5, 2023
1 parent 995f451 commit 0f04323
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 21 deletions.
2 changes: 1 addition & 1 deletion src/compacts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ where
}

/// Find compact and move current parser position accordingly.
pub(crate) fn get_compact<T, B, E>(
pub fn get_compact<T, B, E>(
data: &B,
ext_memory: &mut E,
position: &mut usize,
Expand Down
12 changes: 6 additions & 6 deletions src/decoding_sci.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ use crate::MarkedData;
///
/// Current parser position gets changed. Propagated to this point
/// [`SpecialtySet`] is used.
pub(crate) fn decode_type_def_primitive<B, E>(
pub fn decode_type_def_primitive<B, E>(
found_ty: &TypeDefPrimitive,
data: &B,
ext_memory: &mut E,
Expand Down Expand Up @@ -297,7 +297,7 @@ where
}

/// [`TypeParameter`](scale_info::TypeParameter) name for `call`.
pub(crate) const CALL_INDICATOR: &str = "Call";
pub const CALL_INDICATOR: &str = "Call";

/// General decoder function. Parse part of data as [`Ty`].
///
Expand Down Expand Up @@ -809,7 +809,7 @@ where
/// First data `u8` element is `index` of [`Variant`].
///
/// Does not modify the input.
pub(crate) fn pick_variant<'a, B, E>(
pub fn pick_variant<'a, B, E>(
variants: &'a [Variant<PortableForm>],
data: &B,
ext_memory: &mut E,
Expand Down Expand Up @@ -998,7 +998,7 @@ where
}

/// Positions and related values for decoding `BitVec`.
pub(crate) struct BitVecPositions {
pub struct BitVecPositions {
/// Encoded `BitVec` start position, includes bit length compact.
bitvec_start: usize,

Expand All @@ -1007,7 +1007,7 @@ pub(crate) struct BitVecPositions {
data_start: usize,

/// Encoded `BitVec` end position.
pub(crate) bitvec_end: usize,
pub bitvec_end: usize,

/// Number of bits in `BitVec`, for patch only.
#[cfg(any(target_pointer_width = "32", test))]
Expand All @@ -1025,7 +1025,7 @@ impl BitVecPositions {
/// New `BitVecPositions` for given input data and position.
///
/// `T` is corresponding `BitStore`.
pub(crate) fn new<T, B, E>(
pub fn new<T, B, E>(
data: &B,
ext_memory: &mut E,
position: usize,
Expand Down
6 changes: 3 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -464,11 +464,11 @@ pub mod additional_types;
pub mod cards;
pub mod compacts;
pub mod cut_metadata;
mod decoding_sci;
pub mod decoding_sci;
mod decoding_sci_ext;
pub mod error;
pub mod printing_balance;
mod propagated;
pub mod propagated;
pub mod special_indicators;
mod special_types;
pub mod storage_data;
Expand Down Expand Up @@ -565,7 +565,7 @@ where
///
/// Extensions are cut to ensure the call decoding never gets outside the
/// call data.
pub(crate) fn data_no_extensions(&self) -> B {
pub fn data_no_extensions(&self) -> B {
self.data.limit_length(self.extensions_start())
}

Expand Down
22 changes: 11 additions & 11 deletions src/propagated.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,12 +189,12 @@ impl Default for Checker {
#[derive(Clone, Debug)]
pub struct Propagated {
/// Type data that is collected and checked during parsing.
pub(crate) checker: Checker,
pub checker: Checker,

/// Set of [`Info`] collected while resolving the type.
///
/// Only non-empty [`Info`] entries are added.
pub(crate) info: Vec<Info>,
pub info: Vec<Info>,
}

impl Propagated {
Expand All @@ -207,7 +207,7 @@ impl Propagated {
}

/// Initiate new `Propagated` for signed extensions instance.
pub(crate) fn from_ext_meta(signed_ext_meta: &SignedExtensionMetadata<PortableForm>) -> Self {
pub fn from_ext_meta(signed_ext_meta: &SignedExtensionMetadata<PortableForm>) -> Self {
Self {
checker: Checker {
specialty_set: SpecialtySet {
Expand All @@ -221,7 +221,7 @@ impl Propagated {
}

/// Initiate new `Propagated` with known, propagated from above `Checker`.
pub(crate) fn with_checker(checker: Checker) -> Self {
pub fn with_checker(checker: Checker) -> Self {
Self {
checker,
info: Vec::new(),
Expand All @@ -230,7 +230,7 @@ impl Propagated {

/// Initiate new `Propagated` with known, propagated from above `Checker`
/// for an individual [`Field`].
pub(crate) fn for_field<E: ExternalMemory>(
pub fn for_field<E: ExternalMemory>(
checker: &Checker,
field: &Field<PortableForm>,
) -> Result<Self, ParserError<E>> {
Expand All @@ -242,7 +242,7 @@ impl Propagated {

/// Initiate new `Propagated` with known, propagated from above `Checker`
/// for a [`Type`].
pub(crate) fn for_ty<E: ExternalMemory>(
pub fn for_ty<E: ExternalMemory>(
checker: &Checker,
ty: &Type<PortableForm>,
id: u32,
Expand All @@ -254,30 +254,30 @@ impl Propagated {
}

/// Get associated `compact_at`
pub(crate) fn compact_at(&self) -> Option<u32> {
pub fn compact_at(&self) -> Option<u32> {
self.checker.specialty_set.compact_at
}

/// Check that `compact_at` field in associated [`SpecialtySet`] is not
/// `Some(_)`, i.e. there was no compact type encountered.
pub(crate) fn reject_compact<E: ExternalMemory>(&self) -> Result<(), ParserError<E>> {
pub fn reject_compact<E: ExternalMemory>(&self) -> Result<(), ParserError<E>> {
self.checker.specialty_set.reject_compact::<E>()
}

/// Discard previously found [`Hint`].
pub(crate) fn forget_hint(&mut self) {
pub fn forget_hint(&mut self) {
self.checker.forget_hint()
}

/// Add [`Info`] entry (if non-empty) to `info` set.
pub(crate) fn add_info(&mut self, info_update: &Info) {
pub fn add_info(&mut self, info_update: &Info) {
if !info_update.is_empty() {
self.info.push(info_update.clone())
}
}

/// Add `&[Info]` to `info` set.
pub(crate) fn add_info_slice(&mut self, info_update_slice: &[Info]) {
pub fn add_info_slice(&mut self, info_update_slice: &[Info]) {
self.info.extend_from_slice(info_update_slice)
}
}
Expand Down

0 comments on commit 0f04323

Please sign in to comment.