Skip to content

Commit

Permalink
Merge pull request #5291 from wasmerio/run-534-make-wasix-capabilitie…
Browse files Browse the repository at this point in the history
…s-hashable

chore(wasix): make Capabilities hashable
  • Loading branch information
syrusakbary authored Dec 10, 2024
2 parents 25bec06 + 5a8f547 commit 68e81dd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions lib/wasix/src/capabilities.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::time::Duration;
use crate::http::HttpClientCapabilityV1;

/// Defines capabilities for a Wasi environment.
#[derive(Clone, Debug)]
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
pub struct Capabilities {
pub insecure_allow_all: bool,
pub http_client: HttpClientCapabilityV1,
Expand Down Expand Up @@ -40,7 +40,7 @@ impl Default for Capabilities {
}

/// Defines threading related permissions.
#[derive(Debug, Default, Clone)]
#[derive(Debug, Default, Clone, PartialEq, Eq, Hash)]
pub struct CapabilityThreadingV1 {
/// Maximum number of threads that can be spawned.
///
Expand Down
10 changes: 5 additions & 5 deletions lib/wasix/src/http/client.rs
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
use std::{collections::HashSet, ops::Deref, sync::Arc};
use std::{collections::BTreeSet, ops::Deref, sync::Arc};

use futures::future::BoxFuture;
use http::{HeaderMap, Method, StatusCode};
use url::Url;

/// Defines http client permissions.
#[derive(Clone, Debug)]
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
pub struct HttpClientCapabilityV1 {
pub allow_all: bool,
pub allowed_hosts: HashSet<String>,
pub allowed_hosts: BTreeSet<String>,
}

impl HttpClientCapabilityV1 {
pub fn new() -> Self {
Self {
allow_all: false,
allowed_hosts: HashSet::new(),
allowed_hosts: Default::default(),
}
}

pub fn new_allow_all() -> Self {
Self {
allow_all: true,
allowed_hosts: HashSet::new(),
allowed_hosts: Default::default(),
}
}

Expand Down

0 comments on commit 68e81dd

Please sign in to comment.