pub struct GoProxyUrl { /* private fields */ }Expand description
A validated, normalized, https-only Go module proxy URL with no embedded userinfo.
Mirrors deps_pypi::config::PypiIndexUrl/deps_npm::config::NpmRegistryIndex; kept
deps-go-local rather than promoted to deps-core per this spec’s Open Questions
(consolidate only once a fourth near-identical implementation makes the duplication
concrete).
Implementations§
Source§impl GoProxyUrl
impl GoProxyUrl
Sourcepub fn new(
raw: &str,
policy: &RegistryAccessPolicy,
) -> Result<Self, GoProxyUrlError>
pub fn new( raw: &str, policy: &RegistryAccessPolicy, ) -> Result<Self, GoProxyUrlError>
Validates and normalizes raw against policy.
§Errors
Returns GoProxyUrlError if raw does not parse as a URL, is not https (outside
the cfg(test)/test-util loopback carve-out), carries a userinfo component, or
resolves to a host class the current policy blocks.
§Examples
use deps_core::net_policy::RegistryAccessPolicy;
use deps_go::config::GoProxyUrl;
let policy = RegistryAccessPolicy::default();
assert!(GoProxyUrl::new("https://goproxy.mycorp.example", &policy).is_ok());
assert!(GoProxyUrl::new("http://goproxy.mycorp.example", &policy).is_err());
assert!(GoProxyUrl::new("https://user:pass@goproxy.mycorp.example", &policy).is_err());Trait Implementations§
Source§impl Clone for GoProxyUrl
impl Clone for GoProxyUrl
Source§fn clone(&self) -> GoProxyUrl
fn clone(&self) -> GoProxyUrl
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for GoProxyUrl
impl Debug for GoProxyUrl
Source§impl Display for GoProxyUrl
impl Display for GoProxyUrl
impl Eq for GoProxyUrl
Source§impl Hash for GoProxyUrl
impl Hash for GoProxyUrl
Source§impl PartialEq for GoProxyUrl
impl PartialEq for GoProxyUrl
Source§fn eq(&self, other: &GoProxyUrl) -> bool
fn eq(&self, other: &GoProxyUrl) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for GoProxyUrl
Auto Trait Implementations§
impl Freeze for GoProxyUrl
impl RefUnwindSafe for GoProxyUrl
impl Send for GoProxyUrl
impl Sync for GoProxyUrl
impl Unpin for GoProxyUrl
impl UnsafeUnpin for GoProxyUrl
impl UnwindSafe for GoProxyUrl
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.