Skip to content

Commit

Permalink
refactor: replace pub(crate) with ::new()
Browse files Browse the repository at this point in the history
  • Loading branch information
coroiu committed Oct 14, 2024
1 parent 5ea7645 commit fe72f34
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 6 deletions.
4 changes: 2 additions & 2 deletions crates/bitwarden-wasm-internal/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ impl BitwardenClient {
}

pub fn crypto(&self) -> ClientCrypto {
ClientCrypto(self.0.clone())
ClientCrypto::new(self.0.clone())
}

Check warning on line 62 in crates/bitwarden-wasm-internal/src/client.rs

View check run for this annotation

Codecov / codecov/patch

crates/bitwarden-wasm-internal/src/client.rs#L60-L62

Added lines #L60 - L62 were not covered by tests

pub fn vault(&self) -> ClientVault {
ClientVault(self.0.clone())
ClientVault::new(self.0.clone())
}

Check warning on line 66 in crates/bitwarden-wasm-internal/src/client.rs

View check run for this annotation

Codecov / codecov/patch

crates/bitwarden-wasm-internal/src/client.rs#L64-L66

Added lines #L64 - L66 were not covered by tests
}
8 changes: 7 additions & 1 deletion crates/bitwarden-wasm-internal/src/crypto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,13 @@ use wasm_bindgen::prelude::*;
use crate::error::Result;

#[wasm_bindgen]
pub struct ClientCrypto(pub(crate) Rc<Client>);
pub struct ClientCrypto(Rc<Client>);

impl ClientCrypto {
pub fn new(client: Rc<Client>) -> Self {
Self(client)
}

Check warning on line 17 in crates/bitwarden-wasm-internal/src/crypto.rs

View check run for this annotation

Codecov / codecov/patch

crates/bitwarden-wasm-internal/src/crypto.rs#L15-L17

Added lines #L15 - L17 were not covered by tests
}

#[wasm_bindgen]

Check warning on line 20 in crates/bitwarden-wasm-internal/src/crypto.rs

View check run for this annotation

Codecov / codecov/patch

crates/bitwarden-wasm-internal/src/crypto.rs#L20

Added line #L20 was not covered by tests
impl ClientCrypto {
Expand Down
8 changes: 7 additions & 1 deletion crates/bitwarden-wasm-internal/src/vault/folders.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,13 @@ use wasm_bindgen::prelude::*;
use crate::error::Result;

#[wasm_bindgen]
pub struct ClientFolders(pub(crate) Rc<Client>);
pub struct ClientFolders(Rc<Client>);

impl ClientFolders {
pub fn new(client: Rc<Client>) -> Self {
Self(client)
}

Check warning on line 15 in crates/bitwarden-wasm-internal/src/vault/folders.rs

View check run for this annotation

Codecov / codecov/patch

crates/bitwarden-wasm-internal/src/vault/folders.rs#L13-L15

Added lines #L13 - L15 were not covered by tests
}

#[wasm_bindgen]

Check warning on line 18 in crates/bitwarden-wasm-internal/src/vault/folders.rs

View check run for this annotation

Codecov / codecov/patch

crates/bitwarden-wasm-internal/src/vault/folders.rs#L18

Added line #L18 was not covered by tests
impl ClientFolders {
Expand Down
10 changes: 8 additions & 2 deletions crates/bitwarden-wasm-internal/src/vault/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,17 @@ use wasm_bindgen::prelude::*;
use crate::ClientFolders;

#[wasm_bindgen]
pub struct ClientVault(pub(crate) Rc<Client>);
pub struct ClientVault(Rc<Client>);

impl ClientVault {
pub fn new(client: Rc<Client>) -> Self {
Self(client)
}

Check warning on line 16 in crates/bitwarden-wasm-internal/src/vault/mod.rs

View check run for this annotation

Codecov / codecov/patch

crates/bitwarden-wasm-internal/src/vault/mod.rs#L14-L16

Added lines #L14 - L16 were not covered by tests
}

#[wasm_bindgen]

Check warning on line 19 in crates/bitwarden-wasm-internal/src/vault/mod.rs

View check run for this annotation

Codecov / codecov/patch

crates/bitwarden-wasm-internal/src/vault/mod.rs#L19

Added line #L19 was not covered by tests
impl ClientVault {
pub fn folders(&self) -> ClientFolders {
ClientFolders(self.0.clone())
ClientFolders::new(self.0.clone())
}

Check warning on line 23 in crates/bitwarden-wasm-internal/src/vault/mod.rs

View check run for this annotation

Codecov / codecov/patch

crates/bitwarden-wasm-internal/src/vault/mod.rs#L21-L23

Added lines #L21 - L23 were not covered by tests
}

0 comments on commit fe72f34

Please sign in to comment.