Skip to main content

BlockedSourceClass

Struct BlockedSourceClass 

Source
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: HostClass

The blocked host’s classification.

§raw_value: String

The exact declared value (URL/alias) that resolved to a blocked host.

§declaration_key: String

Implementation-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

Source

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

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for BlockedSourceClass

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Manual, not derived: same raw_value/declaration_key leak class and redactor pairing as BlockedRegistryOccurrence’s own manual Debug impl (CWE-532, #1222).

Source§

impl Eq for BlockedSourceClass

Source§

impl PartialEq for BlockedSourceClass

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for BlockedSourceClass

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more