Debian Codegraph @

src/binary_data.rs

raw symbols SCIP
1 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::opsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/::Derefrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/Deref#;
2 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::osrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/::fdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/fd/::{AsRawFdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/fd/raw/AsRawFd#, OwnedFdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/fd/owned/OwnedFd#};
3 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::syncrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/::Arcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/Arc#;
4
5 use serderust-analyzer cargo serde 1.0.228 crate/::{Deserializerust-analyzer cargo serde_core 1.0.228 de/Deserialize#, Deserializerrust-analyzer cargo serde_core 1.0.228 de/Deserializer#, Serializerust-analyzer cargo serde_core 1.0.228 ser/Serialize#, Serializerrust-analyzer cargo serde_core 1.0.228 ser/Serializer#};
6
7 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(zvariantrust-analyzer cargo zvariant 5.10.0 crate/::Typerust-analyzer cargo zvariant_derive 5.10.0 Type:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:)]
8 #[zvariant(signature = "h")]
9 pub struct BinaryDatarust-analyzer cargo glycin-common 1.0.4 binary_data/BinaryData# {
10 pub(craterust-analyzer cargo glycin-common 1.0.4 crate/) memfdrust-analyzer cargo glycin-common 1.0.4 binary_data/BinaryData#memfd.: Arcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/Arc#<zvariantrust-analyzer cargo zvariant 5.10.0 crate/::OwnedFdrust-analyzer cargo zvariant 5.10.0 fd/OwnedFd#>,
11 }
12
13 impl Serializerust-analyzer cargo serde_core 1.0.228 ser/Serialize# for BinaryDatarust-analyzer cargo glycin-common 1.0.4 binary_data/BinaryData# {
14 fn serializerust-analyzer cargo glycin-common 1.0.4 binary_data/impl#[BinaryData][Serialize]serialize().<S>(&self, serializer: S) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<S::Okrust-analyzer cargo serde_core 1.0.228 ser/Serializer#Ok#, S::Errorrust-analyzer cargo serde_core 1.0.228 ser/Serializer#Error#>
15 where
16 S: Serializerrust-analyzer cargo serde_core 1.0.228 ser/Serializer#,
17 {
18 self.memfdrust-analyzer cargo glycin-common 1.0.4 binary_data/BinaryData#memfd..serializerust-analyzer cargo zvariant 5.10.0 fd/impl#[OwnedFd][Serialize]serialize().(serializer)
19 }
20 }
21
22 impl<'de> Deserializerust-analyzer cargo serde_core 1.0.228 de/Deserialize#<'de> for BinaryDatarust-analyzer cargo glycin-common 1.0.4 binary_data/BinaryData# {
23 fn deserializerust-analyzer cargo glycin-common 1.0.4 binary_data/impl#[BinaryData][`Deserialize<'de>`]deserialize().<D>(deserializer: D) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<BinaryDatarust-analyzer cargo glycin-common 1.0.4 binary_data/BinaryData#, D::Errorrust-analyzer cargo serde_core 1.0.228 de/Deserializer#Error#>
24 where
25 D: Deserializerrust-analyzer cargo serde_core 1.0.228 de/Deserializer#<'de>,
26 {
27 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Selfrust-analyzer cargo glycin-common 1.0.4 binary_data/impl#[BinaryData][`Deserialize<'de>`] {
28 memfdrust-analyzer cargo glycin-common 1.0.4 binary_data/BinaryData#memfd.: Arcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/Arc#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/impl#[`Arc<T>`]new().(zvariantrust-analyzer cargo zvariant 5.10.0 crate/::OwnedFdrust-analyzer cargo zvariant 5.10.0 fd/OwnedFd#::deserializerust-analyzer cargo zvariant 5.10.0 fd/impl#[OwnedFd][`Deserialize<'de>`]deserialize().(deserializer)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().),
29 })
30 }
31 }
32
33 impl AsRawFdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/fd/raw/AsRawFd# for BinaryDatarust-analyzer cargo glycin-common 1.0.4 binary_data/BinaryData# {
34 fn as_raw_fdrust-analyzer cargo glycin-common 1.0.4 binary_data/impl#[BinaryData][AsRawFd]as_raw_fd().(&self) -> stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::osrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/::unixrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/unix/::preluderust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/unix/prelude/::RawFdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/fd/raw/RawFd# {
35 self.memfdrust-analyzer cargo glycin-common 1.0.4 binary_data/BinaryData#memfd..as_raw_fdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/fd/raw/impl#[`alloc_crate::sync::Arc<T>`][AsRawFd]as_raw_fd().()
36 }
37 }
38
39 impl AsRawFdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/fd/raw/AsRawFd# for &BinaryDatarust-analyzer cargo glycin-common 1.0.4 binary_data/BinaryData# {
40 fn as_raw_fdrust-analyzer cargo glycin-common 1.0.4 binary_data/impl#[`&BinaryData`][AsRawFd]as_raw_fd().(&self) -> stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::osrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/::unixrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/unix/::preluderust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/unix/prelude/::RawFdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/fd/raw/RawFd# {
41 self.memfdrust-analyzer cargo glycin-common 1.0.4 binary_data/BinaryData#memfd..as_raw_fdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/fd/raw/impl#[`alloc_crate::sync::Arc<T>`][AsRawFd]as_raw_fd().()
42 }
43 }
44
45 impl Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<OwnedFdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/fd/owned/OwnedFd#> for BinaryDatarust-analyzer cargo glycin-common 1.0.4 binary_data/BinaryData# {
46 fn fromrust-analyzer cargo glycin-common 1.0.4 binary_data/impl#[BinaryData][`From<OwnedFd>`]from().(value: OwnedFdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/fd/owned/OwnedFd#) -> Selfrust-analyzer cargo glycin-common 1.0.4 binary_data/impl#[BinaryData][`From<OwnedFd>`] {
47 let owned_fd = zvariantrust-analyzer cargo zvariant 5.10.0 crate/::OwnedFdrust-analyzer cargo zvariant 5.10.0 fd/OwnedFd#::fromrust-analyzer cargo zvariant 5.10.0 fd/impl#[OwnedFd][`From<std::os::unix::prelude::OwnedFd>`]from().(value);
48 BinaryDatarust-analyzer cargo glycin-common 1.0.4 binary_data/BinaryData# {
49 memfdrust-analyzer cargo glycin-common 1.0.4 binary_data/BinaryData#memfd.: Arcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/Arc#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/impl#[`Arc<T>`]new().(owned_fd),
50 }
51 }
52 }
53
54 impl BinaryDatarust-analyzer cargo glycin-common 1.0.4 binary_data/BinaryData# {
55 /// Get a copy of the binary data
56 pub fn get_fullrust-analyzer cargo glycin-common 1.0.4 binary_data/impl#[BinaryData]get_full().(&self) -> stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<u8>> {
57 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(self.getrust-analyzer cargo glycin-common 1.0.4 binary_data/impl#[BinaryData]get().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch()..to_vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc slice/impl#[`[T]`]to_vec().())
58 }
59
60 /// Get a reference to the binary data
61 pub fn getrust-analyzer cargo glycin-common 1.0.4 binary_data/impl#[BinaryData]get().(&self) -> stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<BinaryDataRefrust-analyzer cargo glycin-common 1.0.4 binary_data/BinaryDataRef#> {
62 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(BinaryDataRefrust-analyzer cargo glycin-common 1.0.4 binary_data/BinaryDataRef# {
63 mmaprust-analyzer cargo glycin-common 1.0.4 binary_data/BinaryDataRef#mmap.: { unsafe { memmaprust-analyzer cargo memmap2 0.9.10 crate/::MmapOptionsrust-analyzer cargo memmap2 0.9.10 MmapOptions#::newrust-analyzer cargo memmap2 0.9.10 impl#[MmapOptions]new().().map_copy_read_onlyrust-analyzer cargo memmap2 0.9.10 impl#[MmapOptions]map_copy_read_only().(&self.memfdrust-analyzer cargo glycin-common 1.0.4 binary_data/BinaryData#memfd.)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch(). } },
64 })
65 }
66 }
67
68 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:)]
69 pub struct BinaryDataRefrust-analyzer cargo glycin-common 1.0.4 binary_data/BinaryDataRef# {
70 mmaprust-analyzer cargo glycin-common 1.0.4 binary_data/BinaryDataRef#mmap.: memmaprust-analyzer cargo memmap2 0.9.10 crate/::Mmaprust-analyzer cargo memmap2 0.9.10 Mmap#,
71 }
72
73 impl Derefrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/Deref# for BinaryDataRefrust-analyzer cargo glycin-common 1.0.4 binary_data/BinaryDataRef# {
74 type Targetrust-analyzer cargo glycin-common 1.0.4 binary_data/impl#[BinaryDataRef][Deref]Target# = [u8];
75
76 fn derefrust-analyzer cargo glycin-common 1.0.4 binary_data/impl#[BinaryDataRef][Deref]deref().(&self) -> &[u8] {
77 self.mmaprust-analyzer cargo glycin-common 1.0.4 binary_data/BinaryDataRef#mmap..derefrust-analyzer cargo memmap2 0.9.10 impl#[Mmap][Deref]deref().()
78 }
79 }
80
81 impl AsRefrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/AsRef#<[u8]> for BinaryDataRefrust-analyzer cargo glycin-common 1.0.4 binary_data/BinaryDataRef# {
82 fn as_refrust-analyzer cargo glycin-common 1.0.4 binary_data/impl#[BinaryDataRef][`AsRef<[u8]>`]as_ref().(&self) -> &[u8] {
83 self.mmaprust-analyzer cargo glycin-common 1.0.4 binary_data/BinaryDataRef#mmap..derefrust-analyzer cargo memmap2 0.9.10 impl#[Mmap][Deref]deref().()
84 }
85 }