Skip to main content

async_fuser/ll/reply_async/
getattr.rs

1//! Response data implementation of [`crate::AsyncFilesystem::getattr`] operation to
2//! send to the kernel
3
4use std::time::Duration;
5
6use crate::FileAttr;
7use crate::ll::ResponseStruct;
8use crate::ll::ioslice_concat::IosliceConcat;
9use crate::ll::reply::Attr;
10use crate::ll::reply::Response;
11
12/// Response data from [`crate::AsyncFilesystem::getattr`] operation
13#[derive(Debug)]
14pub struct GetAttrResponse {
15    ttl: Duration,
16    attr: FileAttr,
17}
18
19impl GetAttrResponse {
20    /// Creates a `GetAttrResponse` object
21    pub fn new(ttl: Duration, attr: FileAttr) -> Self {
22        Self { ttl, attr }
23    }
24}
25
26impl Response for GetAttrResponse {
27    fn payload(&self) -> impl IosliceConcat {
28        ResponseStruct::new_attr(&self.ttl, &Attr::from(self.attr))
29    }
30}