Skip to main content

async_fuser/ll/reply_async/
create.rs

1//! Response data implementation of [`crate::AsyncFilesystem::create`] operation.
2
3use std::time::Duration;
4
5use crate::FileAttr;
6use crate::FopenFlags;
7use crate::Generation;
8use crate::ll::FileHandle;
9use crate::ll::ResponseStruct;
10use crate::ll::ioslice_concat::IosliceConcat;
11use crate::ll::reply::Attr;
12use crate::ll::reply::Response;
13
14/// Response data from [`crate::AsyncFilesystem::create`] operation.
15#[derive(Debug)]
16pub struct CreateResponse {
17    ttl: Duration,
18    attr: FileAttr,
19    generation: Generation,
20    fh: FileHandle,
21    flags: FopenFlags,
22}
23
24impl CreateResponse {
25    /// Creates a new [`CreateResponse`].
26    pub fn new(
27        ttl: Duration,
28        attr: FileAttr,
29        generation: Generation,
30        fh: FileHandle,
31        flags: FopenFlags,
32    ) -> Self {
33        Self {
34            ttl,
35            attr,
36            generation,
37            fh,
38            flags,
39        }
40    }
41}
42
43impl Response for CreateResponse {
44    fn payload(&self) -> impl IosliceConcat {
45        ResponseStruct::new_create(
46            &self.ttl,
47            &Attr::from(self.attr),
48            self.generation,
49            self.fh,
50            self.flags,
51            0,
52        )
53    }
54}