pub struct BlockedSourceClass {
pub class: HostClass,
pub raw_value: String,
pub declaration_key: String,
}Expand description
One host-class/raw-value/declaration-key classification an ecosystem config’s own
blocked_class_for helper produces.
One layer below the ParseResult::blocked_registries trait boundary — same field shape as
BlockedRegistryOccurrence minus BlockedRegistryOccurrence::range, which the config
layer never knows: the caller attaches it per affected dependency via
Self::into_occurrence.
A named struct rather than a positional tuple (#966): Self::raw_value and
Self::declaration_key are both Strings, so a positional tuple would let them be
silently swapped at any call site with no compile error — the exact field-swap risk
BlockedRegistryOccurrence itself was already converted off of (#944 M9). Implemented by
deps_nuget::config::NuGetConfig::blocked_class_for, deps_npm::config::NpmConfig::blocked_class_for,
and deps_pypi::config::PypiIndexConfig::blocked_class_for.
Fields§
§class: HostClassThe blocked host’s classification.
raw_value: StringThe exact declared value (URL/alias) that resolved to a blocked host.
declaration_key: StringImplementation-opaque string identifying which underlying config declaration produced
this entry — see BlockedRegistryOccurrence::declaration_key’s doc for why this must
stay distinct from Self::raw_value.
Implementations§
Source§impl BlockedSourceClass
impl BlockedSourceClass
Sourcepub fn into_occurrence(self, range: Range) -> BlockedRegistryOccurrence
pub fn into_occurrence(self, range: Range) -> BlockedRegistryOccurrence
Attaches the affected dependency’s range to produce the BlockedRegistryOccurrence
a ParseResult::blocked_registries() override reports.
§Examples
use deps_core::net_policy::HostClass;
use deps_core::BlockedSourceClass;
use deps_core::position::{Position, Range};
let class = BlockedSourceClass {
class: HostClass::Loopback,
raw_value: "https://internal.example/index".to_string(),
declaration_key: "primary".to_string(),
};
let range = Range::new(Position::new(0, 0), Position::new(0, 4));
let occurrence = class.into_occurrence(range);
assert_eq!(occurrence.declaration_key, "primary");Trait Implementations§
Source§impl Clone for BlockedSourceClass
impl Clone for BlockedSourceClass
Source§impl Debug for BlockedSourceClass
impl Debug for BlockedSourceClass
impl Eq for BlockedSourceClass
Source§impl PartialEq for BlockedSourceClass
impl PartialEq for BlockedSourceClass
impl StructuralPartialEq for BlockedSourceClass
Auto Trait Implementations§
impl Freeze for BlockedSourceClass
impl RefUnwindSafe for BlockedSourceClass
impl Send for BlockedSourceClass
impl Sync for BlockedSourceClass
impl Unpin for BlockedSourceClass
impl UnsafeUnpin for BlockedSourceClass
impl UnwindSafe for BlockedSourceClass
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.