pub struct EntryAclBlob { /* private fields */ }Expand description
Wraps an AAEntryACLBlob handle.
Implementations§
Source§impl EntryAclBlob
impl EntryAclBlob
Sourcepub fn new() -> Result<Self>
pub fn new() -> Result<Self>
Wraps AAEntryACLBlobCreate.
Examples found in repository?
examples/09_aa_entry_blobs.rs (line 30)
9fn main() -> Result<(), Box<dyn std::error::Error>> {
10 let artifact_dir = artifact_dir("aa-entry-blobs");
11 let dir = path_string(&artifact_dir);
12 let source_name = "source.txt";
13 let target_name = "target.txt";
14 let source_path = path_string(&artifact_dir.join(source_name));
15 let target_path = path_string(&artifact_dir.join(target_name));
16 fs::write(&source_path, b"blob source")?;
17 fs::write(&target_path, b"blob target")?;
18
19 Command::new("xattr")
20 .args(["-w", "com.example.compression-rs", "example", &source_path])
21 .status()?;
22
23 let acl_entry = AccessControlEntry {
24 tag: 1,
25 perms: 1 << 1,
26 flags: 0,
27 qualifier_type: AceQualifierType::User,
28 qualifier: env::var("USER")?.into_bytes(),
29 };
30 let mut acl = EntryAclBlob::new()?;
31 acl.append_entry(&acl_entry)?;
32 let xat = EntryXatBlob::from_path(&dir, source_name, ArchiveFlags::empty())?;
33 if !acl.is_empty() {
34 let encoded = acl.encoded_data()?;
35 let decoded = EntryAclBlob::from_encoded_data(&encoded)?;
36 decoded.apply_to_path(&dir, target_name, ArchiveFlags::REPLACE_ATTRIBUTES)?;
37 }
38 let encoded_xat = xat.encoded_data()?;
39 let decoded_xat = EntryXatBlob::from_encoded_data(&encoded_xat)?;
40 decoded_xat.apply_to_path(&dir, target_name, ArchiveFlags::REPLACE_ATTRIBUTES)?;
41
42 println!(
43 "acl_entries={} xattrs={}",
44 acl.entry_count(),
45 xat.entry_count()
46 );
47 println!("✅ AppleArchive ACL/XAT blob helpers OK");
48 Ok(())
49}Sourcepub fn from_encoded_data(data: &[u8]) -> Result<Self>
pub fn from_encoded_data(data: &[u8]) -> Result<Self>
Wraps AAEntryACLBlobCreateWithEncodedData.
Examples found in repository?
examples/09_aa_entry_blobs.rs (line 35)
9fn main() -> Result<(), Box<dyn std::error::Error>> {
10 let artifact_dir = artifact_dir("aa-entry-blobs");
11 let dir = path_string(&artifact_dir);
12 let source_name = "source.txt";
13 let target_name = "target.txt";
14 let source_path = path_string(&artifact_dir.join(source_name));
15 let target_path = path_string(&artifact_dir.join(target_name));
16 fs::write(&source_path, b"blob source")?;
17 fs::write(&target_path, b"blob target")?;
18
19 Command::new("xattr")
20 .args(["-w", "com.example.compression-rs", "example", &source_path])
21 .status()?;
22
23 let acl_entry = AccessControlEntry {
24 tag: 1,
25 perms: 1 << 1,
26 flags: 0,
27 qualifier_type: AceQualifierType::User,
28 qualifier: env::var("USER")?.into_bytes(),
29 };
30 let mut acl = EntryAclBlob::new()?;
31 acl.append_entry(&acl_entry)?;
32 let xat = EntryXatBlob::from_path(&dir, source_name, ArchiveFlags::empty())?;
33 if !acl.is_empty() {
34 let encoded = acl.encoded_data()?;
35 let decoded = EntryAclBlob::from_encoded_data(&encoded)?;
36 decoded.apply_to_path(&dir, target_name, ArchiveFlags::REPLACE_ATTRIBUTES)?;
37 }
38 let encoded_xat = xat.encoded_data()?;
39 let decoded_xat = EntryXatBlob::from_encoded_data(&encoded_xat)?;
40 decoded_xat.apply_to_path(&dir, target_name, ArchiveFlags::REPLACE_ATTRIBUTES)?;
41
42 println!(
43 "acl_entries={} xattrs={}",
44 acl.entry_count(),
45 xat.entry_count()
46 );
47 println!("✅ AppleArchive ACL/XAT blob helpers OK");
48 Ok(())
49}Sourcepub fn from_path(dir: &str, path: &str, flags: ArchiveFlags) -> Result<Self>
pub fn from_path(dir: &str, path: &str, flags: ArchiveFlags) -> Result<Self>
Wraps AAEntryACLBlobCreateWithPath.
Sourcepub fn apply_to_path(
&self,
dir: &str,
path: &str,
flags: ArchiveFlags,
) -> Result<()>
pub fn apply_to_path( &self, dir: &str, path: &str, flags: ArchiveFlags, ) -> Result<()>
Wraps AAEntryACLBlobApplyToPath.
Examples found in repository?
examples/09_aa_entry_blobs.rs (line 36)
9fn main() -> Result<(), Box<dyn std::error::Error>> {
10 let artifact_dir = artifact_dir("aa-entry-blobs");
11 let dir = path_string(&artifact_dir);
12 let source_name = "source.txt";
13 let target_name = "target.txt";
14 let source_path = path_string(&artifact_dir.join(source_name));
15 let target_path = path_string(&artifact_dir.join(target_name));
16 fs::write(&source_path, b"blob source")?;
17 fs::write(&target_path, b"blob target")?;
18
19 Command::new("xattr")
20 .args(["-w", "com.example.compression-rs", "example", &source_path])
21 .status()?;
22
23 let acl_entry = AccessControlEntry {
24 tag: 1,
25 perms: 1 << 1,
26 flags: 0,
27 qualifier_type: AceQualifierType::User,
28 qualifier: env::var("USER")?.into_bytes(),
29 };
30 let mut acl = EntryAclBlob::new()?;
31 acl.append_entry(&acl_entry)?;
32 let xat = EntryXatBlob::from_path(&dir, source_name, ArchiveFlags::empty())?;
33 if !acl.is_empty() {
34 let encoded = acl.encoded_data()?;
35 let decoded = EntryAclBlob::from_encoded_data(&encoded)?;
36 decoded.apply_to_path(&dir, target_name, ArchiveFlags::REPLACE_ATTRIBUTES)?;
37 }
38 let encoded_xat = xat.encoded_data()?;
39 let decoded_xat = EntryXatBlob::from_encoded_data(&encoded_xat)?;
40 decoded_xat.apply_to_path(&dir, target_name, ArchiveFlags::REPLACE_ATTRIBUTES)?;
41
42 println!(
43 "acl_entries={} xattrs={}",
44 acl.entry_count(),
45 xat.entry_count()
46 );
47 println!("✅ AppleArchive ACL/XAT blob helpers OK");
48 Ok(())
49}Sourcepub fn entry_count(&self) -> u32
pub fn entry_count(&self) -> u32
Wraps AAEntryACLBlobGetEntry.
Examples found in repository?
examples/09_aa_entry_blobs.rs (line 44)
9fn main() -> Result<(), Box<dyn std::error::Error>> {
10 let artifact_dir = artifact_dir("aa-entry-blobs");
11 let dir = path_string(&artifact_dir);
12 let source_name = "source.txt";
13 let target_name = "target.txt";
14 let source_path = path_string(&artifact_dir.join(source_name));
15 let target_path = path_string(&artifact_dir.join(target_name));
16 fs::write(&source_path, b"blob source")?;
17 fs::write(&target_path, b"blob target")?;
18
19 Command::new("xattr")
20 .args(["-w", "com.example.compression-rs", "example", &source_path])
21 .status()?;
22
23 let acl_entry = AccessControlEntry {
24 tag: 1,
25 perms: 1 << 1,
26 flags: 0,
27 qualifier_type: AceQualifierType::User,
28 qualifier: env::var("USER")?.into_bytes(),
29 };
30 let mut acl = EntryAclBlob::new()?;
31 acl.append_entry(&acl_entry)?;
32 let xat = EntryXatBlob::from_path(&dir, source_name, ArchiveFlags::empty())?;
33 if !acl.is_empty() {
34 let encoded = acl.encoded_data()?;
35 let decoded = EntryAclBlob::from_encoded_data(&encoded)?;
36 decoded.apply_to_path(&dir, target_name, ArchiveFlags::REPLACE_ATTRIBUTES)?;
37 }
38 let encoded_xat = xat.encoded_data()?;
39 let decoded_xat = EntryXatBlob::from_encoded_data(&encoded_xat)?;
40 decoded_xat.apply_to_path(&dir, target_name, ArchiveFlags::REPLACE_ATTRIBUTES)?;
41
42 println!(
43 "acl_entries={} xattrs={}",
44 acl.entry_count(),
45 xat.entry_count()
46 );
47 println!("✅ AppleArchive ACL/XAT blob helpers OK");
48 Ok(())
49}Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Wraps AAEntryACLBlobGetEntry.
Examples found in repository?
examples/09_aa_entry_blobs.rs (line 33)
9fn main() -> Result<(), Box<dyn std::error::Error>> {
10 let artifact_dir = artifact_dir("aa-entry-blobs");
11 let dir = path_string(&artifact_dir);
12 let source_name = "source.txt";
13 let target_name = "target.txt";
14 let source_path = path_string(&artifact_dir.join(source_name));
15 let target_path = path_string(&artifact_dir.join(target_name));
16 fs::write(&source_path, b"blob source")?;
17 fs::write(&target_path, b"blob target")?;
18
19 Command::new("xattr")
20 .args(["-w", "com.example.compression-rs", "example", &source_path])
21 .status()?;
22
23 let acl_entry = AccessControlEntry {
24 tag: 1,
25 perms: 1 << 1,
26 flags: 0,
27 qualifier_type: AceQualifierType::User,
28 qualifier: env::var("USER")?.into_bytes(),
29 };
30 let mut acl = EntryAclBlob::new()?;
31 acl.append_entry(&acl_entry)?;
32 let xat = EntryXatBlob::from_path(&dir, source_name, ArchiveFlags::empty())?;
33 if !acl.is_empty() {
34 let encoded = acl.encoded_data()?;
35 let decoded = EntryAclBlob::from_encoded_data(&encoded)?;
36 decoded.apply_to_path(&dir, target_name, ArchiveFlags::REPLACE_ATTRIBUTES)?;
37 }
38 let encoded_xat = xat.encoded_data()?;
39 let decoded_xat = EntryXatBlob::from_encoded_data(&encoded_xat)?;
40 decoded_xat.apply_to_path(&dir, target_name, ArchiveFlags::REPLACE_ATTRIBUTES)?;
41
42 println!(
43 "acl_entries={} xattrs={}",
44 acl.entry_count(),
45 xat.entry_count()
46 );
47 println!("✅ AppleArchive ACL/XAT blob helpers OK");
48 Ok(())
49}Sourcepub fn entry(&self, index: u32) -> Result<AccessControlEntry>
pub fn entry(&self, index: u32) -> Result<AccessControlEntry>
Wraps AAEntryACLBlobGetEntry.
Sourcepub fn entries(&self) -> Result<Vec<AccessControlEntry>>
pub fn entries(&self) -> Result<Vec<AccessControlEntry>>
Wraps AAEntryACLBlobAppendEntry.
Sourcepub fn append_entry(&mut self, entry: &AccessControlEntry) -> Result<()>
pub fn append_entry(&mut self, entry: &AccessControlEntry) -> Result<()>
Wraps AAEntryACLBlobAppendEntry.
Examples found in repository?
examples/09_aa_entry_blobs.rs (line 31)
9fn main() -> Result<(), Box<dyn std::error::Error>> {
10 let artifact_dir = artifact_dir("aa-entry-blobs");
11 let dir = path_string(&artifact_dir);
12 let source_name = "source.txt";
13 let target_name = "target.txt";
14 let source_path = path_string(&artifact_dir.join(source_name));
15 let target_path = path_string(&artifact_dir.join(target_name));
16 fs::write(&source_path, b"blob source")?;
17 fs::write(&target_path, b"blob target")?;
18
19 Command::new("xattr")
20 .args(["-w", "com.example.compression-rs", "example", &source_path])
21 .status()?;
22
23 let acl_entry = AccessControlEntry {
24 tag: 1,
25 perms: 1 << 1,
26 flags: 0,
27 qualifier_type: AceQualifierType::User,
28 qualifier: env::var("USER")?.into_bytes(),
29 };
30 let mut acl = EntryAclBlob::new()?;
31 acl.append_entry(&acl_entry)?;
32 let xat = EntryXatBlob::from_path(&dir, source_name, ArchiveFlags::empty())?;
33 if !acl.is_empty() {
34 let encoded = acl.encoded_data()?;
35 let decoded = EntryAclBlob::from_encoded_data(&encoded)?;
36 decoded.apply_to_path(&dir, target_name, ArchiveFlags::REPLACE_ATTRIBUTES)?;
37 }
38 let encoded_xat = xat.encoded_data()?;
39 let decoded_xat = EntryXatBlob::from_encoded_data(&encoded_xat)?;
40 decoded_xat.apply_to_path(&dir, target_name, ArchiveFlags::REPLACE_ATTRIBUTES)?;
41
42 println!(
43 "acl_entries={} xattrs={}",
44 acl.entry_count(),
45 xat.entry_count()
46 );
47 println!("✅ AppleArchive ACL/XAT blob helpers OK");
48 Ok(())
49}Sourcepub fn set_entry(
&mut self,
index: u32,
entry: &AccessControlEntry,
) -> Result<()>
pub fn set_entry( &mut self, index: u32, entry: &AccessControlEntry, ) -> Result<()>
Wraps AAEntryACLBlobSetEntry.
Sourcepub fn remove_entry(&mut self, index: u32) -> Result<()>
pub fn remove_entry(&mut self, index: u32) -> Result<()>
Wraps AAEntryACLBlobRemoveEntry.
Sourcepub fn encoded_size(&self) -> usize
pub fn encoded_size(&self) -> usize
Wraps AAEntryACLBlobGetEncodedData.
Sourcepub fn encoded_data(&self) -> Result<Vec<u8>>
pub fn encoded_data(&self) -> Result<Vec<u8>>
Wraps AAEntryACLBlobGetEncodedData.
Examples found in repository?
examples/09_aa_entry_blobs.rs (line 34)
9fn main() -> Result<(), Box<dyn std::error::Error>> {
10 let artifact_dir = artifact_dir("aa-entry-blobs");
11 let dir = path_string(&artifact_dir);
12 let source_name = "source.txt";
13 let target_name = "target.txt";
14 let source_path = path_string(&artifact_dir.join(source_name));
15 let target_path = path_string(&artifact_dir.join(target_name));
16 fs::write(&source_path, b"blob source")?;
17 fs::write(&target_path, b"blob target")?;
18
19 Command::new("xattr")
20 .args(["-w", "com.example.compression-rs", "example", &source_path])
21 .status()?;
22
23 let acl_entry = AccessControlEntry {
24 tag: 1,
25 perms: 1 << 1,
26 flags: 0,
27 qualifier_type: AceQualifierType::User,
28 qualifier: env::var("USER")?.into_bytes(),
29 };
30 let mut acl = EntryAclBlob::new()?;
31 acl.append_entry(&acl_entry)?;
32 let xat = EntryXatBlob::from_path(&dir, source_name, ArchiveFlags::empty())?;
33 if !acl.is_empty() {
34 let encoded = acl.encoded_data()?;
35 let decoded = EntryAclBlob::from_encoded_data(&encoded)?;
36 decoded.apply_to_path(&dir, target_name, ArchiveFlags::REPLACE_ATTRIBUTES)?;
37 }
38 let encoded_xat = xat.encoded_data()?;
39 let decoded_xat = EntryXatBlob::from_encoded_data(&encoded_xat)?;
40 decoded_xat.apply_to_path(&dir, target_name, ArchiveFlags::REPLACE_ATTRIBUTES)?;
41
42 println!(
43 "acl_entries={} xattrs={}",
44 acl.entry_count(),
45 xat.entry_count()
46 );
47 println!("✅ AppleArchive ACL/XAT blob helpers OK");
48 Ok(())
49}Trait Implementations§
Source§impl Clone for EntryAclBlob
impl Clone for EntryAclBlob
Source§impl Debug for EntryAclBlob
impl Debug for EntryAclBlob
Source§impl Drop for EntryAclBlob
impl Drop for EntryAclBlob
Auto Trait Implementations§
impl !Send for EntryAclBlob
impl !Sync for EntryAclBlob
impl Freeze for EntryAclBlob
impl RefUnwindSafe for EntryAclBlob
impl Unpin for EntryAclBlob
impl UnsafeUnpin for EntryAclBlob
impl UnwindSafe for EntryAclBlob
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more