Debian Codegraph @

src/lib.rs

raw symbols SCIP
1 extern crate libcrust-analyzer cargo uname 0.1.1 libc/;
2
3 use 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/;
4 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::ffirust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/::CStrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/c_str/CStr#;
5
6 use libcrust-analyzer cargo libc 0.2.189 crate/::{utsnamerust-analyzer cargo libc 0.2.189 unix/linux_like/utsname#, c_charrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_char#};
7
8 #[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:)]
9 pub struct Inforust-analyzer cargo uname 0.1.1 Info# {
10 pub sysnamerust-analyzer cargo uname 0.1.1 Info#sysname.: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#,
11 pub nodenamerust-analyzer cargo uname 0.1.1 Info#nodename.: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#,
12 pub releaserust-analyzer cargo uname 0.1.1 Info#release.: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#,
13 pub versionrust-analyzer cargo uname 0.1.1 Info#version.: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#,
14 pub machinerust-analyzer cargo uname 0.1.1 Info#machine.: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#,
15 _privrust-analyzer cargo uname 0.1.1 Info#_priv.: (),
16 }
17
18 impl Inforust-analyzer cargo uname 0.1.1 Info# {
19 pub fn newrust-analyzer cargo uname 0.1.1 impl#[Info]new().() -> 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#<Selfrust-analyzer cargo uname 0.1.1 impl#[Info]> {
20 let mut n = unsafe { stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::zeroedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/zeroed().() };
21 let r = unsafe { libcrust-analyzer cargo libc 0.2.189 crate/::unamerust-analyzer cargo libc 0.2.189 uname().(&mut n) };
22 if r rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]eq().0 {
23 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#::fromrust-analyzer cargo uname 0.1.1 impl#[Info][`From<utsname>`]from().(n))
24 } else {
25 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Error#::last_os_errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/impl#[Error]last_os_error().())
26 }
27 }
28 }
29
30 #[inline]
31 fn to_cstrrust-analyzer cargo uname 0.1.1 to_cstr().(buf: &[c_charrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_char#]) -> &CStrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/c_str/CStr# {
32 unsafe { CStrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/c_str/CStr#::from_ptrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/c_str/impl#[CStr]from_ptr().(buf.as_ptrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]as_ptr().()) }
33 }
34
35 impl Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<utsnamerust-analyzer cargo libc 0.2.189 unix/linux_like/utsname#> for Inforust-analyzer cargo uname 0.1.1 Info# {
36 fn fromrust-analyzer cargo uname 0.1.1 impl#[Info][`From<utsname>`]from().(x: utsnamerust-analyzer cargo libc 0.2.189 unix/linux_like/utsname#) -> Selfrust-analyzer cargo uname 0.1.1 impl#[Info][`From<utsname>`] {
37 Inforust-analyzer cargo uname 0.1.1 Info# {
38 sysnamerust-analyzer cargo uname 0.1.1 Info#sysname.: to_cstrrust-analyzer cargo uname 0.1.1 to_cstr().(&x.sysnamerust-analyzer cargo libc 0.2.189 unix/linux_like/utsname#sysname.[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().).to_string_lossyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc ffi/c_str/impl#[CStr]to_string_lossy().().into_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/impl#[`Cow<'_, B>`]into_owned().(),
39 nodenamerust-analyzer cargo uname 0.1.1 Info#nodename.: to_cstrrust-analyzer cargo uname 0.1.1 to_cstr().(&x.nodenamerust-analyzer cargo libc 0.2.189 unix/linux_like/utsname#nodename.[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().).to_string_lossyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc ffi/c_str/impl#[CStr]to_string_lossy().().into_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/impl#[`Cow<'_, B>`]into_owned().(),
40 releaserust-analyzer cargo uname 0.1.1 Info#release.: to_cstrrust-analyzer cargo uname 0.1.1 to_cstr().(&x.releaserust-analyzer cargo libc 0.2.189 unix/linux_like/utsname#release.[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().).to_string_lossyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc ffi/c_str/impl#[CStr]to_string_lossy().().into_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/impl#[`Cow<'_, B>`]into_owned().(),
41 versionrust-analyzer cargo uname 0.1.1 Info#version.: to_cstrrust-analyzer cargo uname 0.1.1 to_cstr().(&x.versionrust-analyzer cargo libc 0.2.189 unix/linux_like/utsname#version.[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().).to_string_lossyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc ffi/c_str/impl#[CStr]to_string_lossy().().into_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/impl#[`Cow<'_, B>`]into_owned().(),
42 machinerust-analyzer cargo uname 0.1.1 Info#machine.: to_cstrrust-analyzer cargo uname 0.1.1 to_cstr().(&x.machinerust-analyzer cargo libc 0.2.189 unix/linux_like/utsname#machine.[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().).to_string_lossyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc ffi/c_str/impl#[CStr]to_string_lossy().().into_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/impl#[`Cow<'_, B>`]into_owned().(),
43 _privrust-analyzer cargo uname 0.1.1 Info#_priv.: (),
44 }
45 }
46 }
47
48 pub fn unamerust-analyzer cargo uname 0.1.1 uname().() -> 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#<Inforust-analyzer cargo uname 0.1.1 Info#> {
49 Inforust-analyzer cargo uname 0.1.1 Info#::newrust-analyzer cargo uname 0.1.1 impl#[Info]new().()
50 }