Skip to content

Commit

Permalink
refactor: Make SafeUrlParts pub(super)
Browse files Browse the repository at this point in the history
This came from a separate crate, so `pub(crate)` was sufficient before.
Now that it's part of the overall `safe_network` crate its necessary to
reduce the visibility further to avoid leaking implementation details.
  • Loading branch information
Chris Connelly authored and bochaco committed Jul 6, 2021
1 parent a627f0b commit a75218d
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions src/url/url_parts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,22 +64,22 @@ const INVALID_NRS_CHARS: [char; 30] = [
// A simple struct to represent the basic components parsed
// from a Safe URL without any decoding.
//
// This is kept internal to the crate, at least for now.
// This is kept internal to the parent module.
#[derive(Debug, Clone)]
pub(crate) struct SafeUrlParts {
pub scheme: String,
pub public_name: String, // "a.b.name" in "a.b.name"
pub top_name: String, // "name" in "a.b.name"
pub sub_names: String, // "a.b" in "a.b.name"
pub sub_names_vec: Vec<String>,
pub path: String,
pub query_string: String,
pub fragment: String,
pub(super) struct SafeUrlParts {
pub(super) scheme: String,
pub(super) public_name: String, // "a.b.name" in "a.b.name"
pub(super) top_name: String, // "name" in "a.b.name"
pub(super) sub_names: String, // "a.b" in "a.b.name"
pub(super) sub_names_vec: Vec<String>,
pub(super) path: String,
pub(super) query_string: String,
pub(super) fragment: String,
}

impl SafeUrlParts {
// parses a URL into its component parts, performing basic validation.
pub fn parse(url: &str, ignore_labels_size: bool) -> Result<Self> {
pub(super) fn parse(url: &str, ignore_labels_size: bool) -> Result<Self> {
// detect any invalid url chars before parsing
validate_url_chars(url)?;
// Note: we use rust-url for parsing because it is most widely used
Expand Down

0 comments on commit a75218d

Please sign in to comment.