-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix: add some license for every files
- extract UrlParam to single file - fix github ci error
- Loading branch information
Showing
47 changed files
with
963 additions
and
731 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -64,6 +64,7 @@ jobs: | |
image: nacos/nacos-server:v2.3.1 | ||
ports: | ||
- 8848:8848 | ||
- 9848:9848 | ||
env: | ||
MODE: standalone | ||
steps: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
use crate::{url::UrlParam, StdError}; | ||
use std::{borrow::Cow, convert::Infallible, str::FromStr}; | ||
|
||
pub struct ExtensionName(String); | ||
|
||
impl ExtensionName { | ||
pub fn new(name: String) -> Self { | ||
ExtensionName(name) | ||
} | ||
} | ||
|
||
impl UrlParam for ExtensionName { | ||
type TargetType = String; | ||
|
||
fn name() -> &'static str { | ||
"extension-name" | ||
} | ||
|
||
fn value(&self) -> Self::TargetType { | ||
self.0.clone() | ||
} | ||
|
||
fn as_str(&self) -> Cow<str> { | ||
self.0.as_str().into() | ||
} | ||
} | ||
|
||
impl FromStr for ExtensionName { | ||
type Err = StdError; | ||
|
||
fn from_str(s: &str) -> Result<Self, Self::Err> { | ||
Ok(ExtensionName::new(s.to_string())) | ||
} | ||
} | ||
|
||
pub enum ExtensionType { | ||
Registry, | ||
} | ||
|
||
impl UrlParam for ExtensionType { | ||
type TargetType = String; | ||
|
||
fn name() -> &'static str { | ||
"extension-type" | ||
} | ||
|
||
fn value(&self) -> Self::TargetType { | ||
match self { | ||
ExtensionType::Registry => "registry".to_owned(), | ||
} | ||
} | ||
|
||
fn as_str(&self) -> Cow<str> { | ||
match self { | ||
ExtensionType::Registry => Cow::Borrowed("registry"), | ||
} | ||
} | ||
} | ||
|
||
impl FromStr for ExtensionType { | ||
type Err = Infallible; | ||
|
||
fn from_str(s: &str) -> Result<Self, Self::Err> { | ||
match s { | ||
"registry" => Ok(ExtensionType::Registry), | ||
_ => panic!("the extension type enum is not in range"), | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.