refactor: make redacted inner element private
This commit is contained in:
parent
72dd5c72c1
commit
e602194f85
|
@ -24,6 +24,6 @@ pub async fn public_key(state: Arc<RwLock<State>>, conn: &mut WsStream, number:
|
||||||
crate::util::send(conn, number, PublicKeyResponse {
|
crate::util::send(conn, number, PublicKeyResponse {
|
||||||
name: req.name,
|
name: req.name,
|
||||||
world: req.world,
|
world: req.world,
|
||||||
pk: pk.map(Redacted),
|
pk: pk.map(Redacted::new),
|
||||||
}).await
|
}).await
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,9 +7,13 @@ use sqlx::database::HasArguments;
|
||||||
use sqlx::encode::IsNull;
|
use sqlx::encode::IsNull;
|
||||||
|
|
||||||
#[repr(transparent)]
|
#[repr(transparent)]
|
||||||
pub struct Redacted<T>(pub T);
|
pub struct Redacted<T>(T);
|
||||||
|
|
||||||
impl<T> Redacted<T> {
|
impl<T> Redacted<T> {
|
||||||
|
pub fn new(t: T) -> Self {
|
||||||
|
Self(t)
|
||||||
|
}
|
||||||
|
|
||||||
pub fn into_inner(self) -> T {
|
pub fn into_inner(self) -> T {
|
||||||
self.0
|
self.0
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue