fallow_core/plugins/
federation_source.rs1use std::path::PathBuf;
2
3use super::PathRule;
4
5#[derive(Debug, Clone, PartialEq, Eq)]
7pub struct FederationSource {
8 pub target: FederationSourceTarget,
10 pub config_path: PathBuf,
12 pub plugin: String,
14 pub key: &'static str,
16}
17
18#[derive(Debug, Clone, PartialEq, Eq)]
20pub enum FederationSourceTarget {
21 Exposed(PathRule),
23 Remote(String),
25}
26
27impl FederationSource {
28 #[must_use]
29 pub(super) fn prefixed(&self, ws_prefix: &str) -> Self {
30 let target = match &self.target {
31 FederationSourceTarget::Exposed(rule) => {
32 FederationSourceTarget::Exposed(rule.prefixed(ws_prefix))
33 }
34 FederationSourceTarget::Remote(alias) => FederationSourceTarget::Remote(alias.clone()),
35 };
36 Self {
37 target,
38 config_path: self.config_path.clone(),
39 plugin: self.plugin.clone(),
40 key: self.key,
41 }
42 }
43}