//! Find virtual directory result //! //! @author Pierre Hubert use serde::{Serialize}; use crate::data::error::ResultBoxError; use crate::data::user::User; #[derive(Serialize)] pub struct ResultFindVirtualDirectory { kind: String, id: u64, } impl ResultFindVirtualDirectory { /// Construct a new instance pub fn new(user: ResultBoxError, group: ResultBoxError) -> ResultFindVirtualDirectory { match (user, group) { // User (Ok(u), _) => ResultFindVirtualDirectory { kind: "user".to_string(), id: u.id as u64 }, // Group (_, Ok(g)) => ResultFindVirtualDirectory { kind: "group".to_string(), id: g }, _ => unreachable!() } } }