Skip to main content

StructuralUnit

Struct StructuralUnit 

Source
pub struct StructuralUnit {
Show 14 fields pub file: usize, pub kind: UnitKind, pub range: ByteRange, pub start_line: u32, pub end_line: u32, pub token_start: usize, pub token_end: usize, pub name: Option<Lexeme>, pub boilerplate: Option<Boilerplate>, pub test_code: bool, pub test_code_evidence: Option<TestCodeEvidence>, pub fingerprint: UnitFingerprint, pub content: FragmentFingerprint, pub normalized_content: FragmentFingerprint,
}
Expand description

One analysed unit, kept so a caller can map a group’s member indices back to source locations. The index of a unit in StructuralReport::units is the index grouping refers to.

Fields§

§file: usize

Index of the file this unit belongs to (into the input slice).

§kind: UnitKind

What kind of unit this is; reporting only.

§range: ByteRange

Source bytes the unit covers; reporting only.

§start_line: u32

1-based first line; reporting only, never an identity input.

§end_line: u32

1-based last line; reporting only, never an identity input.

§token_start: usize

Index of the unit’s first token in its file’s stream.

§token_end: usize

Index one past the unit’s last token in its file’s stream.

§name: Option<Lexeme>

The unit’s declared name, when the frontend recovered one.

§boilerplate: Option<Boilerplate>

The boilerplate shape the unit matches, when it matches one. Recorded, not acted on: a classified unit is analysed and grouped like any other.

§test_code: bool

Whether the unit is test code: marked as a test itself, or sitting inside an item that is. Recorded, not acted on, as boilerplate is.

§test_code_evidence: Option<TestCodeEvidence>

Why this unit is test code, when it is test code.

Structural analysis initially records marker evidence. A caller that knows the scan’s configured test paths can add path evidence after the analysis, without changing candidate extraction or grouping.

§fingerprint: UnitFingerprint

The unit’s raw content fingerprint: its stable grouping key and unit identity.

§content: FragmentFingerprint

The unit’s content fingerprint in fragment form, used as its member content id when composing a group fingerprint (a whole-unit clone is a fragment spanning the unit; keeping this as a fragment fingerprint keeps the group id forward-compatible with sub-unit members).

§normalized_content: FragmentFingerprint

Identifier-normalized content used only for non-Type-1 group identity. Unit identity remains raw so distinct renamed occurrences never merge.

Trait Implementations§

Source§

impl Clone for StructuralUnit

Source§

fn clone(&self) -> StructuralUnit

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 StructuralUnit

Source§

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

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

impl Eq for StructuralUnit

Source§

impl PartialEq for StructuralUnit

Source§

fn eq(&self, other: &StructuralUnit) -> 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 StructuralUnit

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

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, 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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. 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 = 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.