Skip to main content

System

Struct System 

Source
pub struct System { /* private fields */ }
Expand description

The real world: the operating system’s randomness, clock and keystore, and the terminal.

Implementations§

Source§

impl System

Source

pub fn new() -> Self

The real world. The platform’s keystore is connected to only when a command needs it.

Trait Implementations§

Source§

impl Default for System

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Environment for System

Source§

type Rng = UnwrapErr<SysRng>

The kind of random number generator.
Source§

fn rng(&mut self) -> &mut Self::Rng

A cryptographically secure random number generator.
Source§

fn now(&self) -> u64

The wall clock time, in milliseconds since 1970 (UTC).
Source§

fn offset_minutes(&self) -> i32

The device’s offset from UTC, in minutes, at the current time.
Source§

fn time_zone(&self) -> TimeZone

The device’s time zone, by which times are read and shown: a fixed offset from UTC, Environment::offset_minutes, unless the environment knows the zone’s rules.
Source§

fn passphrase(&mut self, prompt: &str) -> Result<Zeroizing<String>>

Asks the person for a passphrase. Read more
Source§

fn passphrase_params(&self) -> PassphraseParams

How much work deriving a key from a new passphrase takes.
Source§

fn computer_name(&self) -> String

The computer’s name, the default name of a device.
Source§

fn account(&self) -> Account

The person’s account on this computer, after which a new library’s user is named.
Source§

fn current_dir(&self) -> Result<PathBuf>

The current folder: nib init makes it a library, and the other commands look for their library in it and in the folders it is in. Read more
Source§

fn default_library(&self) -> Option<PathBuf>

The folder of the library that commands work in outside every library’s folder, if the person names one: NIBKEEP_LIBRARY.
Source§

fn ceiling(&self) -> Option<PathBuf>

A folder in which, and above which, commands do not look for their library, as Git’s GIT_CEILING_DIRECTORIES says: tests keep to their own folders with it, and the end-to-end tests name it in NIBKEEP_CEILING.
Source§

fn keystore(&mut self) -> bool

Whether the platform has a keystore to keep a library’s keys in, connecting to it the first time.
Source§

fn downloads(&self) -> Option<PathBuf>

This device’s downloads folder, as the platform names it, if it has one.
Source§

fn state_folder(&self) -> Option<PathBuf>

This computer’s folder of NibKeep’s state, where the list of libraries synced from login is (technical design): None where there is none.
Source§

fn login_entry(&self) -> Option<LoginEntry>

The login entry that starts nibkeep-sync, where the platform has one.
Source§

fn open_firewall(&mut self) -> Firewall

Lets the person’s other devices reach this computer through its firewall, where nib does that, as on Windows, asking for the administrator’s consent.
Source§

fn sync_program(&self) -> Option<PathBuf>

The copy of nibkeep-sync installed beside nib, if there is one.
Source§

fn nib_program(&self) -> Option<PathBuf>

The program of nib itself, which AI clients run as a library’s server.
Source§

fn ai_client(&self, program: &str) -> Option<Command>

A command of the AI client’s program program, such as claude, if it is installed here, to tell the client of a server or take it away: none unless the environment finds it.
Source§

fn can_ask(&self) -> bool

Whether Environment::ask has someone to ask, as before showing a code that would be spent without an answer.
Source§

fn ask(&mut self, question: &str) -> Result<Option<String>>

Asks the person a question on the terminal, and returns the answer, or None if there is no terminal to ask on, as for a script or an AI agent. Read more
Source§

fn clipboard(&mut self) -> Result<Box<dyn Board>, ClipboardError>

The clipboard, to copy secrets to: none, unless the environment has one. Read more
Source§

fn interruptible(&mut self)

Makes an interruption, as with Ctrl+C, end the next wait rather than nib, from now on: before nib copies a secret, so that an interruption never leaves it on the clipboard.
Source§

fn stop_on_interrupt(&mut self, stop: Arc<AtomicBool>)

Makes an interruption, as with Ctrl+C, set stop rather than end nib: for a command that runs until stopped, and lets go of what it holds as it ends.
Source§

fn wait(&mut self, duration: Duration) -> bool

Waits for duration, or until the person interrupts nib, as with Ctrl+C, whichever comes first. Returns whether the person interrupted it.
Source§

fn languages(&self) -> Vec<String>

The languages the system is set to, first the one it uses, as the platform names them, such as en_US.UTF-8 or en-US.
Source§

fn note(&mut self, line: &str)

Tells the person something beside what the command writes: on standard error, so that output that other programs read stays as it is.
Source§

fn git(&self) -> Command

The person’s own Git, with their settings and credentials, as a command to give arguments to (technical design).
Source§

fn sync_version(&self, program: &Path) -> Option<String>

The engine’s version that a copy of nibkeep-sync tells, or None if it is gone.
Source§

fn start_sync(&mut self, program: &Path) -> Result<(), NodeError>

Starts a copy of nibkeep-sync, apart from nib, so that it runs on when nib ends. Read more

Auto Trait Implementations§

§

impl !Sync for System

§

impl Forget for System

§

impl Freeze for System

§

impl Move for System

§

impl RefUnwindSafe for System

§

impl Send for System

§

impl Unpin for System

§

impl UnsafeUnpin for System

§

impl UnwindSafe for System

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
Source§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> NoneValue for T
where T: Default,

Source§

type NoneType = T

Source§

fn null_value() -> T

The none-equivalent value.
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more