Skip to main content

BipolarFramework

Struct BipolarFramework 

Source
pub struct BipolarFramework<A: Clone + Eq + Hash> { /* private fields */ }
Expand description

A bipolar argumentation framework over argument type A.

The type is generic over A to match the core crate’s convention — A can be String, &'static str, a custom ArgumentId newtype, etc.

Implementations§

Source§

impl<A: Clone + Eq + Hash> BipolarFramework<A>

Source

pub fn new() -> Self

Create an empty framework.

Source

pub fn add_argument(&mut self, a: A)

Add an argument. Adding an argument that already exists is a no-op.

Source

pub fn add_attack(&mut self, attacker: A, target: A)

Add an attack attacker → target. Both arguments are implicitly added to the framework if not already present. Adding the same attack twice is a no-op.

Source

pub fn add_support(&mut self, supporter: A, supported: A) -> Result<(), Error>
where A: Debug,

Add a support supporter → supported. Both arguments are implicitly added. Adding the same support twice is a no-op. Returns Error::IllegalSelfSupport if supporter == supported — an argument cannot be its own necessary supporter.

Source

pub fn remove_support(&mut self, supporter: &A, supported: &A) -> bool

Remove a support edge. Returns true if the edge was present. Used by consumers modelling betrayal (a support edge is retracted). Does NOT remove the endpoint arguments from the framework.

Source

pub fn remove_attack(&mut self, attacker: &A, target: &A) -> bool

Remove an attack edge. Returns true if the edge was present.

Source

pub fn arguments(&self) -> impl Iterator<Item = &A>

Iterate over all arguments in the framework.

Source

pub fn attacks(&self) -> impl Iterator<Item = (&A, &A)>

Iterate over all direct attack edges.

Source

pub fn supports(&self) -> impl Iterator<Item = (&A, &A)>

Iterate over all direct support edges.

Source

pub fn len(&self) -> usize

Number of arguments in the framework.

Source

pub fn is_empty(&self) -> bool

Whether the framework has zero arguments.

Source

pub fn direct_attackers(&self, a: &A) -> Vec<&A>

Direct attackers of a (arguments X such that X → a in the attack edge set). Does NOT include derived attackers — see crate::derived for the closure.

Source

pub fn direct_supporters(&self, a: &A) -> Vec<&A>

Direct supporters of a (arguments X such that X → a in the support edge set).

Source

pub fn supporter_map(&self) -> HashMap<&A, HashSet<&A>>

Map of each argument to its direct necessary supporters.

Used by the support-closure filter in crate::semantics and by crate::queries for transitive queries.

Trait Implementations§

Source§

impl<A: Clone + Clone + Eq + Hash> Clone for BipolarFramework<A>

Source§

fn clone(&self) -> BipolarFramework<A>

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<A: Debug + Clone + Eq + Hash> Debug for BipolarFramework<A>

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<A: Clone + Eq + Hash> Default for BipolarFramework<A>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<A> Freeze for BipolarFramework<A>

§

impl<A> RefUnwindSafe for BipolarFramework<A>
where A: RefUnwindSafe,

§

impl<A> Send for BipolarFramework<A>
where A: Send,

§

impl<A> Sync for BipolarFramework<A>
where A: Sync,

§

impl<A> Unpin for BipolarFramework<A>
where A: Unpin,

§

impl<A> UnsafeUnpin for BipolarFramework<A>

§

impl<A> UnwindSafe for BipolarFramework<A>
where A: UnwindSafe,

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<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> 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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.