Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasfernog-crabnebula committed May 22, 2024
1 parent 4d8c2cf commit 90ef64e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions crates/devtools-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,5 @@ bytes = "1.5.0"
ringbuf = "0.4.0-rc.3"
async-stream = "0.3.5"
http = "0.2"
hyper = "0.14"
tower = "0.4"
4 changes: 4 additions & 0 deletions crates/devtools-core/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,15 @@ pub struct Server {
}

/// A handle to a server that is allowed to modify its properties (such as CORS allowed origins)
#[allow(clippy::module_name_repetitions)]
#[derive(Clone)]
pub struct ServerHandle {
allowed_origins: Arc<Mutex<Vec<AllowOrigin>>>,
}

impl ServerHandle {
/// Allow the given origin in the instrumentation server CORS.
#[allow(clippy::missing_panics_doc)]
pub fn allow_origin(&self, origin: impl Into<AllowOrigin>) {
self.allowed_origins.lock().unwrap().push(origin.into());
}
Expand Down Expand Up @@ -158,6 +161,7 @@ impl Server {
}
}

#[must_use]
pub fn handle(&self) -> ServerHandle {
self.handle.clone()
}
Expand Down

0 comments on commit 90ef64e

Please sign in to comment.