Skip to main content

InstallProbe

Struct InstallProbe 

Source
pub struct InstallProbe {
    pub analyze: Box<dyn Fn(&Path) -> Option<InstallMethod> + Send + Sync>,
    pub recognizes_bare: Box<dyn Fn(&Path) -> bool + Send + Sync>,
    pub user_config_target: Option<&'static str>,
}
Expand description

Callbacks the analyzer uses to delegate to a game plugin.

Both hooks have sensible defaults (InstallProbe::noop), so a game plugin with no special layouts can just leave them unimplemented.

Fields§

§analyze: Box<dyn Fn(&Path) -> Option<InstallMethod> + Send + Sync>

Return a game-specific InstallMethod if the plugin recognizes the extracted archive authoritatively (e.g. Cyberpunk identifying a REDmod by info.json + archives/ presence). Runs before the generic probes so it can claim layouts that also happen to trigger generic heuristics.

§recognizes_bare: Box<dyn Fn(&Path) -> bool + Send + Sync>

Return true if the extracted archive looks like a bare-extract for this game (e.g. top-level Data/ for Bethesda). Runs as the last fallback before InstallMethod::Unknown.

§user_config_target: Option<&'static str>

Plugin-supplied id of a DeployTargetKind::UserConfig root, if this game advertises one. The analyzer falls back to a InstallMethod::UserConfigOverlay keyed on this id when the archive contains only config-shaped files. None means the game has no user-config target — config-only archives will go straight to Unknown.

Implementations§

Source§

impl InstallProbe

Source

pub fn new<A, B>(analyze: A, recognizes_bare: B) -> Self
where A: Fn(&Path) -> Option<InstallMethod> + Send + Sync + 'static, B: Fn(&Path) -> bool + Send + Sync + 'static,

Construct a probe from two closures.

Source

pub fn with_user_config_target(self, target_id: &'static str) -> Self

Builder: attach a user-config target id. The analyzer will route config-only archives to UserConfigOverlay { target_id }.

Source

pub fn noop() -> Self

A probe that never claims anything game-specific. Used by tests of the generic detection pipeline and as a “no plugin available” fallback.

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> 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: 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: 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> 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.
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