arch_pkg_db/misc/
attachment.rs1mod desc;
2mod into;
3mod utils;
4
5pub use into::IntoAttached;
6pub use utils::AttachedUtils;
7
8use core::fmt::Display;
9use derive_more::{AsMut, AsRef, Deref, DerefMut, Display, Error};
10
11#[derive(Debug, Display, Clone, Copy, AsRef, AsMut, Deref, DerefMut, Error)]
13#[display(bound(Main: Display))]
14#[display("{main}")]
15pub struct Attached<Main, Attachment> {
16 #[deref]
18 #[deref_mut]
19 #[error(source)]
20 main: Main,
21
22 #[as_ref(skip)]
24 #[as_mut(skip)]
25 #[error(not(source))]
26 attachment: Attachment,
27}
28
29impl<Main, Attachment> Attached<Main, Attachment> {
30 pub const fn new(main: Main, attachment: Attachment) -> Self {
32 Attached { main, attachment }
33 }
34
35 pub fn into_tuple(attached: Self) -> (Main, Attachment) {
37 (attached.main, attached.attachment)
38 }
39}