mkrawimg::device

Struct DeviceSpec

source
pub struct DeviceSpec {
Show 18 fields pub id: String, pub aliases: Option<Vec<String>>, pub distro: Distro, pub vendor: String, pub arch: DeviceArch, pub soc_vendor: Option<String>, pub name: String, pub model: Option<String>, pub of_compatible: Option<String>, pub bsp_packages: Vec<String>, pub initrdless: bool, pub kernel_cmdline: Option<Vec<String>>, pub partition_map: PartitionMapType, pub num_partitions: u32, pub size: ImageVariantSizes, pub partitions: Vec<PartitionSpec>, pub bootloaders: Option<Vec<BootloaderSpec>>, pub file_path: PathBuf,
}
Expand description

§Device Specification

A device specification represents a specific model of device in the form of a specification file named device.toml. Most information defined in the device specification are used to build OS images for this device.

It describes various aspects of the device:

  • How many partition the image of this device may contain, their sizes, filesystems.
  • How many BSP packages for this device should be installed in addition to the standard system distribution.
  • Whether the image of the device must have bootloaders applied, and how to apply them.
  • Basic information, like its ID, vendor and model name.

It must be placed under the device-level directory of the device registry.

An optional post-installation script can be placed in the device-level directory to finalize the installation. This script runs after all BSP packages are installed, in the target OS.

One or more optional bootloader scripts can be placed in the device-level directory. Bootloader scripts run after the post-installation script, and also in the target OS.

§Syntax

The device specification uses the TOML format.

§Fields

§id - Device ID

A string which identifies a specific device. Must be unique across the entire registry. It can be a combination of letters (a-z, A-Z), digits (0-9), hyphens (-) and underscores (_).

id = "rpi-9"

§aliases - Device Aliases (Optional)

A list of strings that can also identify this specific device. Must be unique across the entire registry. Aliases follows the same naming restrictions.

alias = ["pi9", "pi9b"]

§vendor - Device Vendor

A string that identifies the vendor of the device. Should be as same as the vendor-level directory name.

vendor = "raspberrypi"

§arch - Device CPU Architecture

A string defines the architecture of the CPU used by this device.

Possible values:

  • "amd64": x86-64 CPU.
  • "arm64": ARM AArch64 CPU.
  • "loongarch64": LoongArch64 CPU.
  • "riscv64": 64-Bit RISC-V CPU.
  • "ppc64el": IBM POWER 8 and up, little-endian.
  • "loongson3": MIPS Loongson-III CPU.
arch = "arm64"

§name - Name of the device

The human-friendly name of the device.

name = "Raspberry Pi 9 Model B"

§of_compatible - compatible Property in the Device Tree (Optional)

The most relevant string in the /compatible property defined in the root of the device tree file. Typically it is the first value of the entry.

If this device does not have a device tree, or the device tree file does not have compatible property defined in its root, this field can be skipped.

For example, suppose the device tree file of the “Raspberry Pi 9 Model B” has the following definition:

/ {
compatible = "raspberrypi,9-model-b", "brcm,bcm9999";
}

The value used here would be "raspberrypi,9-model-b".

of_compatible = "raspberrypi,9-model-b"

§bsp_packages - List of mandatory BSP packages

A list of package names to be installed in addition to the standard system distribution.

Installation of BSP packages will be performed after all mountable partitions in this device are mounted, so that scripts in the packages can access these partitions.

The package names can not be checked for validity. Please make sure all of the names are correct.
bsp_packages = ["linux+kernel+rpi64+rpi9", "rpi-firmware-boot"]

§initrdless - Booting without Init Ramdisk (Optional)

A boolean value describes whether the device boots without an init ramdisk. Typically this is useful for a variety of embedded devices.

Default is false, can be skipped. If set to true, then the following thing will happen:

  • The filesystem table /etc/fstab will be generated using the unique identifiers of the partition (PARTUUID), rather than unique identifiers of the filesystem (UUID).
initrdless = true

§kernel_cmdline - Kernel command line (Optional)

List of strings representing the kernel command line. Can not contain white spaces, and cannot contain root= argument.

The root= command line is automatically generated using either PARTUUID or UUID, depending on whether the device boots without an initrd image.

The final kernel command line will be root= argument concatenated with rest of the arguments.

If this field is defined, the post installation script and any bootloader scripts will be able to reference it with $KERNEL_CMDLINE.

If you want to generate the kernel command line yourself with a script, please skip this field.

# The final command line $KERNEL_CMDLINE:
# "root=PARTUUID=01234567-89ab-cdef-0123-456789abcdef console=ttyS0,115200 console=tty0 rw fsck.repair=yes"
kernel_cmdline = ["console=ttyS0,115200", "console=tty0", "rw", "fsck.repair=yes"]

§[sizes] - Image sizes for each variant

An object describes the image size for each distribution variant: base, desktop and server.

Make sure the sizes defined are large enough to contain the OS and installed BSP packages.

The images will be automatically expanded to the size of the medium during the first boot.

[sizes]
base = 6144
desktop = 22500
server = 6144

§partition_map - Partition Table Type

Type of the partition table used in the OS image.

Possible values:

  • mbr or dos: MBR Partition Table. Can have up to 4 partitions.
  • gpt: GUID Partition Table. Can have up to 128 partitions. Most bootloaders supports GPT.
partition_map = "gpt"

§num_partitions - Number of the partitions

A positive integer. Defines the number of the partitions in the OS image.

num_partitions: 2

§[[partition]] - List of Partitions

A list of objects describes the partitions in the OS image. Refer to the PartitionSpec for details.

[[partition]]
no = 1
type = "esp"
usage = "boot"
size = 614400
mountpoint = "/efi"
filesystem = "fat32"
label = "Boot"
fs_label = "Boot"

[[partition]]
no = 2
type = "linux"
size = 0
mountpoint = "/"
filesystem = "ext4"
usage = "rootfs"
fs_label = "AOSC OS"

§[[bootloader]] - List of Bootloaders to be embedded (Optional)

A list of objects describes bootloaders to be applied onto the OS image. Refer to BootloaderSpec for details.

[[bootloader]]
type = "flash_partition"
path = "/usr/lib/u-boot/rk3588-orange-pi-4-ultra-idbloader.img"
partition = 1

[[bootloader]]
type = "flash_partition"
path = "/usr/lib/u-boot/rk3588-orange-pi-4-ultra-u-boot.itb"
partition = 2

[[bootloader]]
type = "script"
name = "finish-bootloaders.sh"

§Process of building images

  1. This device gets selected in the registry.
  2. An OS image is created with specified size, and is attached to a loop device.
  3. The image is partitioned.
  4. Partitions with filesystem assigned to them is formatted.
  5. Filesystems with a mountpoint will be mounted.
  6. The standard system distribution is installed to the target filesystem, and /etc/fstab is generated.
  7. BSP packages is installed.
  8. The post-installation script is run.
  9. The bootloaders will be applied, if defined in the spec file.
  10. The image is unmounted, detached from the loop device, and is compressed to the output directory.

§Post Installation

An optional post installation script can be run after:

  • All of the filesystems with a mount point are mounted.
  • The standard system distribution is installed.
  • All of the BSP packages gets installed.
  • /etc/fstab is generated.
  • A user is set up.

The post installation script will be run within the target OS image. The script name must be one of:

  • postinst.bash
  • postinst.sh
  • postinst (The shebang is not interpreted, thus must be a shell script)

§Available defined variables

There are a few variables pre-defined in the environment to aid your setup process:

  • DEVICE_ID: Device ID.

  • DEVICE_COMPATIBLE: of_compatible field defined in the device specification. Empty if not defined.

  • LOOPDEV: The loop device this OS image is attached on.

  • NUM_PARTITIONS: Number of the partitions.

  • ROOTPART: The index of the root partition.

  • DISKLABEL: Either mbr or gpt.

  • DISKUUID: UUID of the partition table.

    Either a 32-bit hexadecimal integer or an UUID (Same as the output of blkid).

  • KERNEL_CMDLINE: Full kernel command line with root= argument. Empty if not defined in the spec file.

  • PARTx_PARTUUID: Partition UUID of the xth partition.

    Same as the output of blkid, can be used directly with root=PARTUUID= argument.

  • PARTx_FSUUID: Filesystem UUID of the xth partition.

    Same as the output of blkid, can be used directly with root=UUID= argument. Empty if this partition does not contain a filesystem.

  • BOOT_PARTUUID, BOOT_FSUUID: Partition and Filesystem UUID for the boot partition, if one is found.

  • ROOT_PARTUUID, ROOT_FSUUID: Partition and Filesystem UUID for the root partition.

§Examples

Please refer to the device registry directory in the project for examples.

Fields§

§id: String

Unique ID of the device. Can be any combination of letters, digits, hyphen "-" and underscore ("_").

§aliases: Option<Vec<String>>

Optional aliases to identify the exact device. Can be any combination of letters, digits, hyphen "-" and underscore ("_").

§distro: Distro

The distribution wich will be installed on this device.

Possible values:

  • aosc: AOSC OS.
§vendor: String

Vendor of the device. Can be any combination of letters, digits, hyphen "-" and underscore ("_").

§arch: DeviceArch

CPU Architecture of the device.

Possible values:

  • amd64
  • arm64
  • loongarch64
  • loongson3
  • ppc64el
  • riscv64
  • mips64r6el
§soc_vendor: Option<String>

Vendor of the SoC platform, optional, currently not used. The name must present in arch/$ARCH/boot/dts in the kernel tree.

§name: String

Full name of the device for humans.

§model: Option<String>

Model name of the device, if it is different than the full name.

§of_compatible: Option<String>

The most relevant value of the `compatible`` property defined in the root of the device tree, if present. Otherwise just skip this.

For example, the device tree file of Raspberry Pi 5B defines the following:

/ {
	compatible = "raspberrypi,5-model-b", "brcm,bcm2712";
}

In this case, the value would be "raspberrypi,5-model-b".

§bsp_packages: Vec<String>

List of BSP packages to be installed. Must be a list of valid package names, no checks are performed.

§initrdless: bool

Whether the device boots without an initrd image. Useful for embedded systems (most of devices targeted by this project are embedded systems, aren’t they).

If set to true, the following thing(s) will happen:

  • Generated fstab will use PARTUUID instead of filesystem UUID, since the kernel does not support using UUID= to specify root device if initrd is not being used.
§kernel_cmdline: Option<Vec<String>>

Kernel command line. Must be a list of strings, and root= must not present in this list (it is automatically generated).

§partition_map: PartitionMapType

The partition map used for the image.

Possible values:

  • mbr or dos
  • gpt
§num_partitions: u32

Number of the partitions.

§size: ImageVariantSizes

Size of the image for each variant, in MiB.

§Example
[size]
base = 6144
desktop = 22528
server = 6144
§partitions: Vec<PartitionSpec>

Partitions in the image. Refer to PartitionSpec for details.

Due to how lists of objects are represented in TOML, the singular “partition” is explicitly allowed.

§Example
[[partition]]
num = 1
size = 614400
type = "esp"
filesystem = "fat32"
...

[[partition]]
num = 2
size = 0
type = "linux"
filesystem = "ext4"
...
§bootloaders: Option<Vec<BootloaderSpec>>

Actions to apply bootloaders. Refer to BootloaderSpec for details.

Due to how lists of objects are represented in TOML, the singular “bootloader” is explicitly allowed.

§Example
[[bootloader]]
type = "script"
script = "apply-bootloader.sh"

[[bootloader]]
type = "script"
script = "apply-bootloader2.sh"
§file_path: PathBuf

Path to the device.toml.

This field is ignored during deserialization, and is automatically filled.

Implementations§

source§

impl DeviceSpec

source

pub fn from_path(file: &Path) -> Result<Self>

source

pub fn check(&self) -> Result<()>

source

pub fn gen_kernel_cmdline(&self, pm_data: &PartitionMapData) -> Result<String>

Trait Implementations§

source§

impl Clone for DeviceSpec

source§

fn clone(&self) -> DeviceSpec

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for DeviceSpec

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'de> Deserialize<'de> for DeviceSpec

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more

Auto Trait Implementations§

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<T> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
§

impl<T> Conv for T

§

fn conv<T>(self) -> T
where Self: Into<T>,

Converts self into T using Into<T>. Read more
§

impl<T> FmtForward for T

§

fn fmt_binary(self) -> FmtBinary<Self>
where Self: Binary,

Causes self to use its Binary implementation when Debug-formatted.
§

fn fmt_display(self) -> FmtDisplay<Self>
where Self: Display,

Causes self to use its Display implementation when Debug-formatted.
§

fn fmt_lower_exp(self) -> FmtLowerExp<Self>
where Self: LowerExp,

Causes self to use its LowerExp implementation when Debug-formatted.
§

fn fmt_lower_hex(self) -> FmtLowerHex<Self>
where Self: LowerHex,

Causes self to use its LowerHex implementation when Debug-formatted.
§

fn fmt_octal(self) -> FmtOctal<Self>
where Self: Octal,

Causes self to use its Octal implementation when Debug-formatted.
§

fn fmt_pointer(self) -> FmtPointer<Self>
where Self: Pointer,

Causes self to use its Pointer implementation when Debug-formatted.
§

fn fmt_upper_exp(self) -> FmtUpperExp<Self>
where Self: UpperExp,

Causes self to use its UpperExp implementation when Debug-formatted.
§

fn fmt_upper_hex(self) -> FmtUpperHex<Self>
where Self: UpperHex,

Causes self to use its UpperHex implementation when Debug-formatted.
§

fn fmt_list(self) -> FmtList<Self>
where &'a Self: for<'a> IntoIterator,

Formats each item in a sequence. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

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

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

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.

§

impl<D> OwoColorize for D

§

fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>
where C: Color,

Set the foreground color generically Read more
§

fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>
where C: Color,

Set the background color generically. Read more
§

fn black(&self) -> FgColorDisplay<'_, Black, Self>

Change the foreground color to black
§

fn on_black(&self) -> BgColorDisplay<'_, Black, Self>

Change the background color to black
§

fn red(&self) -> FgColorDisplay<'_, Red, Self>

Change the foreground color to red
§

fn on_red(&self) -> BgColorDisplay<'_, Red, Self>

Change the background color to red
§

fn green(&self) -> FgColorDisplay<'_, Green, Self>

Change the foreground color to green
§

fn on_green(&self) -> BgColorDisplay<'_, Green, Self>

Change the background color to green
§

fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>

Change the foreground color to yellow
§

fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>

Change the background color to yellow
§

fn blue(&self) -> FgColorDisplay<'_, Blue, Self>

Change the foreground color to blue
§

fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>

Change the background color to blue
§

fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>

Change the foreground color to magenta
§

fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>

Change the background color to magenta
§

fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>

Change the foreground color to purple
§

fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>

Change the background color to purple
§

fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>

Change the foreground color to cyan
§

fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>

Change the background color to cyan
§

fn white(&self) -> FgColorDisplay<'_, White, Self>

Change the foreground color to white
§

fn on_white(&self) -> BgColorDisplay<'_, White, Self>

Change the background color to white
§

fn default_color(&self) -> FgColorDisplay<'_, Default, Self>

Change the foreground color to the terminal default
§

fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>

Change the background color to the terminal default
§

fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>

Change the foreground color to bright black
§

fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>

Change the background color to bright black
§

fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>

Change the foreground color to bright red
§

fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>

Change the background color to bright red
§

fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>

Change the foreground color to bright green
§

fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>

Change the background color to bright green
§

fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>

Change the foreground color to bright yellow
§

fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>

Change the background color to bright yellow
§

fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>

Change the foreground color to bright blue
§

fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>

Change the background color to bright blue
§

fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>

Change the foreground color to bright magenta
§

fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>

Change the background color to bright magenta
§

fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>

Change the foreground color to bright purple
§

fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>

Change the background color to bright purple
§

fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>

Change the foreground color to bright cyan
§

fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>

Change the background color to bright cyan
§

fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>

Change the foreground color to bright white
§

fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>

Change the background color to bright white
§

fn bold(&self) -> BoldDisplay<'_, Self>

Make the text bold
§

fn dimmed(&self) -> DimDisplay<'_, Self>

Make the text dim
§

fn italic(&self) -> ItalicDisplay<'_, Self>

Make the text italicized
§

fn underline(&self) -> UnderlineDisplay<'_, Self>

Make the text underlined
Make the text blink
Make the text blink (but fast!)
§

fn reversed(&self) -> ReversedDisplay<'_, Self>

Swap the foreground and background colors
§

fn hidden(&self) -> HiddenDisplay<'_, Self>

Hide the text
§

fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>

Cross out the text
§

fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>
where Color: DynColor,

Set the foreground color at runtime. Only use if you do not know which color will be used at compile-time. If the color is constant, use either [OwoColorize::fg] or a color-specific method, such as [OwoColorize::green], Read more
§

fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>
where Color: DynColor,

Set the background color at runtime. Only use if you do not know what color to use at compile-time. If the color is constant, use either [OwoColorize::bg] or a color-specific method, such as [OwoColorize::on_yellow], Read more
§

fn fg_rgb<const R: u8, const G: u8, const B: u8>( &self, ) -> FgColorDisplay<'_, CustomColor<R, G, B>, Self>

Set the foreground color to a specific RGB value.
§

fn bg_rgb<const R: u8, const G: u8, const B: u8>( &self, ) -> BgColorDisplay<'_, CustomColor<R, G, B>, Self>

Set the background color to a specific RGB value.
§

fn truecolor(&self, r: u8, g: u8, b: u8) -> FgDynColorDisplay<'_, Rgb, Self>

Sets the foreground color to an RGB value.
§

fn on_truecolor(&self, r: u8, g: u8, b: u8) -> BgDynColorDisplay<'_, Rgb, Self>

Sets the background color to an RGB value.
§

fn style(&self, style: Style) -> Styled<&Self>

Apply a runtime-determined style
§

fn if_supports_color<'a, Out, ApplyFn>( &'a self, stream: impl Into<Stream>, apply: ApplyFn, ) -> SupportsColorsDisplay<'a, Self, Out, ApplyFn>
where ApplyFn: Fn(&'a Self) -> Out,

Apply a given transformation function to all formatters if the given stream supports at least basic ANSI colors, allowing you to conditionally apply given styles/colors. Read more
§

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

§

fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> R
where Self: Sized,

Pipes by value. This is generally the method you want to use. Read more
§

fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> R
where R: 'a,

Borrows self and passes that borrow into the pipe function. Read more
§

fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> R
where R: 'a,

Mutably borrows self and passes that borrow into the pipe function. Read more
§

fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
where Self: Borrow<B>, B: 'a + ?Sized, R: 'a,

Borrows self, then passes self.borrow() into the pipe function. Read more
§

fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
where Self: BorrowMut<B>, B: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.borrow_mut() into the pipe function. Read more
§

fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
where Self: AsRef<U>, U: 'a + ?Sized, R: 'a,

Borrows self, then passes self.as_ref() into the pipe function.
§

fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
where Self: AsMut<U>, U: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.as_mut() into the pipe function.
§

fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
where Self: Deref<Target = T>, T: 'a + ?Sized, R: 'a,

Borrows self, then passes self.deref() into the pipe function.
§

fn pipe_deref_mut<'a, T, R>( &'a mut self, func: impl FnOnce(&'a mut T) -> R, ) -> R
where Self: DerefMut<Target = T> + Deref, T: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.deref_mut() into the pipe function.
§

impl<T> Tap for T

§

fn tap(self, func: impl FnOnce(&Self)) -> Self

Immutable access to a value. Read more
§

fn tap_mut(self, func: impl FnOnce(&mut Self)) -> Self

Mutable access to a value. Read more
§

fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
where Self: Borrow<B>, B: ?Sized,

Immutable access to the Borrow<B> of a value. Read more
§

fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
where Self: BorrowMut<B>, B: ?Sized,

Mutable access to the BorrowMut<B> of a value. Read more
§

fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
where Self: AsRef<R>, R: ?Sized,

Immutable access to the AsRef<R> view of a value. Read more
§

fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
where Self: AsMut<R>, R: ?Sized,

Mutable access to the AsMut<R> view of a value. Read more
§

fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
where Self: Deref<Target = T>, T: ?Sized,

Immutable access to the Deref::Target of a value. Read more
§

fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
where Self: DerefMut<Target = T> + Deref, T: ?Sized,

Mutable access to the Deref::Target of a value. Read more
§

fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self

Calls .tap() only in debug builds, and is erased in release builds.
§

fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self

Calls .tap_mut() only in debug builds, and is erased in release builds.
§

fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
where Self: Borrow<B>, B: ?Sized,

Calls .tap_borrow() only in debug builds, and is erased in release builds.
§

fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
where Self: BorrowMut<B>, B: ?Sized,

Calls .tap_borrow_mut() only in debug builds, and is erased in release builds.
§

fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
where Self: AsRef<R>, R: ?Sized,

Calls .tap_ref() only in debug builds, and is erased in release builds.
§

fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
where Self: AsMut<R>, R: ?Sized,

Calls .tap_ref_mut() only in debug builds, and is erased in release builds.
§

fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
where Self: Deref<Target = T>, T: ?Sized,

Calls .tap_deref() only in debug builds, and is erased in release builds.
§

fn tap_deref_mut_dbg<T>(self, func: impl FnOnce(&mut T)) -> Self
where Self: DerefMut<Target = T> + Deref, T: ?Sized,

Calls .tap_deref_mut() only in debug builds, and is erased in release builds.
source§

impl<T> ToOwned for T
where T: Clone,

source§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
§

impl<T> TryConv for T

§

fn try_conv<T>(self) -> Result<T, Self::Error>
where Self: TryInto<T>,

Attempts to convert self into T using TryInto<T>. Read more
source§

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

source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self>

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

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

§

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

§

impl<T> MaybeSendSync for T