Skip to main content

RuleTarget

Enum RuleTarget 

Source
pub enum RuleTarget {
    Path(PathBuf),
    Managed {
        local: PathBuf,
        remote: String,
        poll_interval_secs: Option<u64>,
        push_url: Option<String>,
    },
}
Expand description

Where a rule’s replacement content lives.

A rule’s target is either a plain local path (the classic string form, a plain redirect) or a struct describing a remote-backed managed file: the mod declares what the file is and where its fresh content comes from, and the proxy DLL’s generic managed-file engine takes over from there, no per-mod special-casing inside the DLL.

"target": ".supreme/mods/mymod/data/file.txt"              // classic
"target": {                                                // managed
    "local":  ".supreme/mods/mymod/high_times/file.txt",
    "remote": "https://host/ssbz/index.php?action=room_high_times_file&id=${room}",
    "poll_interval_secs": 10,
    "push_url": "https://host/ssbz/index.php?action=room_high_times_file&id=${room}"
}

Variants§

§

Path(PathBuf)

Plain local redirect target, the original, classic form. Relative paths are interpreted against the game root (joined at resolver load), exactly as before.

§

Managed

Remote-backed managed file. local is the physical file the redirect serves (and the only thing the redirect machinery ever touches); remote is the URL whose body IS the file content (a plain HTTP GET, response bytes used verbatim); poll_interval_secs is the auto-refresh cadence once the game has accessed the file at least once, None/absent means no polling (fetch only on access); push_url is where every game write of the file is POSTed to None/absent means the file is fetch-only (writes stay local and are never uploaded).

All three strings (local, remote, push_url) go through the same ${...} interpolation as every other rule string, so a mod can wire selection-driven values (${tournament_room_id}, ${url_encode(tournament_player)}, …) into the URLs. remote and push_url routinely name the same endpoint (GET = fetch the canonical content, POST = push a game-written file), the two properties exist so a mod author can split the directions across different URLs when their backend wants that.

Fields

§local: PathBuf
§remote: String
§poll_interval_secs: Option<u64>
§push_url: Option<String>

Implementations§

Source§

impl RuleTarget

Source

pub fn path(&self) -> &Path

The local path this target resolves to (the redirect machinery’s only touch point). For a managed target that is the local field.

Source

pub fn managed(&self) -> Option<(&str, Option<u64>, Option<&str>)>

The managed half of this target, if it is one: (remote URL, poll interval in seconds, push URL).

Trait Implementations§

Source§

impl Clone for RuleTarget

Source§

fn clone(&self) -> RuleTarget

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 RuleTarget

Source§

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

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

impl<'de> Deserialize<'de> for RuleTarget

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for RuleTarget

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for RuleTarget

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for RuleTarget

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

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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

§

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