Skip to main content

Request

Struct Request 

Source
pub struct Request<'a> {
    pub seeds: Vec<String>,
    pub paths: BTreeSet<String>,
    pub terms: BTreeSet<String>,
    pub max_depth: usize,
    pub floor: f64,
    pub all_blocking_rules: bool,
    pub branch: Option<&'a str>,
}
Expand description

What the walk was asked to start from and how far it may go.

This is the resolved request, not the caller’s. Every short name is already a canonical identifier, every path has been normalised, and the free-text intent has already become a set of terms by intent_terms — so the walk parses nothing and infers nothing about what it was asked. That separation is what keeps the inference in one place where its confidence can be labelled, instead of spread through the traversal.

paths is wider than what the caller named: it is the union of the request’s own paths and the scope every seed declares, which is how naming an issue selects the contracts over the code that issue is about without the caller listing them.

use std::collections::BTreeSet;

use majordomus_cli::devcontext::select::Request;
use majordomus_cli::devcontext::{intent_terms, DEFAULT_FLOOR, DEFAULT_MAX_DEPTH};

let branch = String::from("master");
let req = Request {
    seeds: vec!["majordomus://issue/I0301".into()],
    // the request named one path; the issue's own declared scope added the other
    paths: BTreeSet::from(["apps/majordomus-cli/src".to_string(), "lib".to_string()]),
    terms: intent_terms("Explain the CONTEXT budget"),
    max_depth: DEFAULT_MAX_DEPTH,
    floor: DEFAULT_FLOOR,
    all_blocking_rules: false,
    branch: Some(&branch),
};

// the intent arrives parsed: lowercased, deduplicated, and without the short words
assert!(req.terms.contains("context") && req.terms.contains("budget"));
assert!(!req.terms.contains("CONTEXT"), "the walk never re-parses the intent");
assert!(!req.terms.contains("the"));

// and the branch is borrowed, because it belongs to the checkout and not to the request
assert_eq!(req.branch, Some("master"));
assert_eq!(req.seeds.len(), 1);

Fields§

§seeds: Vec<String>

The canonical identifiers the request named, already resolved.

§paths: BTreeSet<String>

The repository-relative paths the request named, plus every seed’s declared scope.

§terms: BTreeSet<String>

The words of the intent, lowercased and deduplicated.

§max_depth: usize

The furthest from a seed the walk goes.

§floor: f64

Relevance below this is reached and not offered.

§all_blocking_rules: bool

Every blocking rule of the layer, not only the ones a seed reaches.

§branch: Option<&'a str>

The branch the checkout is on, for selecting the sessions that ran on it.

Auto Trait Implementations§

§

impl<'a> Freeze for Request<'a>

§

impl<'a> RefUnwindSafe for Request<'a>

§

impl<'a> Send for Request<'a>

§

impl<'a> Sync for Request<'a>

§

impl<'a> Unpin for Request<'a>

§

impl<'a> UnsafeUnpin for Request<'a>

§

impl<'a> UnwindSafe for Request<'a>

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
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

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

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

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.

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.
§

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self>

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