-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Regenerated Cargo.lock to fix some vulnerabilities Co-authored-by: Jonathan Richard <[email protected]>
- Loading branch information
1 parent
a44e5fb
commit f359e79
Showing
14 changed files
with
757 additions
and
470 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
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,42 @@ | ||
use syn::{punctuated::Punctuated, Expr, Meta}; | ||
|
||
pub trait LitMatcher<T> { | ||
fn match_type(&self) -> T; | ||
} | ||
|
||
impl LitMatcher<String> for syn::Lit { | ||
fn match_type(&self) -> String { | ||
match self { | ||
syn::Lit::Str(lit) => lit.value(), | ||
_ => panic!("Expected a string literal"), | ||
} | ||
} | ||
} | ||
|
||
impl LitMatcher<bool> for syn::Lit { | ||
fn match_type(&self) -> bool { | ||
match self { | ||
syn::Lit::Bool(lit) => lit.value, | ||
_ => panic!("Expected a boolean literal"), | ||
} | ||
} | ||
} | ||
|
||
pub fn get_name_value<T>(args: &Punctuated<Meta, syn::token::Comma>, name: &str) -> Option<T> | ||
where | ||
syn::Lit: LitMatcher<T>, | ||
{ | ||
args.iter() | ||
.find(|meta| meta.path().is_ident(name)) | ||
.and_then(|meta| { | ||
if let Meta::NameValue(meta) = meta { | ||
if let Expr::Lit(lit) = &meta.value { | ||
Some(lit.lit.match_type()) | ||
} else { | ||
None | ||
} | ||
} else { | ||
None | ||
} | ||
}) | ||
} |
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
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
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,14 @@ | ||
#[derive(Debug, Clone)] | ||
pub struct Config { | ||
pub api_endpoint: String, | ||
pub wss: bool, | ||
} | ||
|
||
impl Default for Config { | ||
fn default() -> Self { | ||
Config { | ||
api_endpoint: String::from("https://heat.tracel.ai/api/"), | ||
wss: true, | ||
} | ||
} | ||
} |
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
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
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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
pub mod cli; | ||
pub mod config; | ||
pub mod registry; | ||
|
||
mod cli_commands; | ||
|
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
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.