#[repr(transparent)]pub struct PgBox<T, AllocatedBy: WhoAllocated<T> = AllocatedByPostgres> { /* private fields */ }
Expand description
Similar to Rust’s Box<T>
type, PgBox<T>
also represents heap-allocated memory.
However, it represents a heap-allocated pointer that was allocated by Postgres’s memory
allocation functions (palloc
, etc). Think of PgBox<T>
as a wrapper around an otherwise
opaque Postgres type that is projected as a concrete Rust type.
Depending on its usage, it’ll interoperate correctly with Rust’s Drop semantics, such that the
backing Postgres-allocated memory is pfree()'d
when the PgBox<T>
is dropped, but it is
possible to effectively return management of the memory back to Postgres (to free on Transaction
end, for example) by calling ::into_pg()
or ``::into_pg_boxed()`. This is especially useful
for returning values back to Postgres.
Examples
This example allocates a simple Postgres structure, modifies it, and returns it back to Postgres:
use pgx::*;
#[pg_guard]
pub fn do_something() -> pg_sys::ItemPointer {
// postgres-allocate an ItemPointerData structure
let mut tid = PgBox::<pg_sys::ItemPointerData>::alloc();
// set its position to 42
tid.ip_posid = 42;
// return it to Postgres
tid.into_pg()
}
A similar example, but instead the PgBox<T>
’s backing memory gets freed when the box is
dropped:
use pgx::*;
#[pg_guard]
pub fn do_something() {
// postgres-allocate an ItemPointerData structure
let mut tid = PgBox::<pg_sys::ItemPointerData>::alloc();
// set its position to 42
tid.ip_posid = 42;
// tid gets dropped here and as such, gets immediately pfree()'d
}
Alternatively, perhaps you want to work with a pointer Postgres gave you as if it were a Rust type, but it can’t be freed on Drop since you don’t own it – Postgres does:
use pgx::*;
#[pg_guard]
pub fn do_something() {
// open a relation and project it as a pg_sys::Relation
let relid: pg_sys::Oid = 42;
let lockmode = pg_sys::AccessShareLock as i32;
let relation = unsafe { PgBox::from_pg(pg_sys::relation_open(relid, lockmode)) };
// do something with/to 'relation'
// ...
// pass the relation back to Postgres
unsafe { pg_sys::relation_close(relation.as_ptr(), lockmode); }
// While the `PgBox` instance gets dropped, the backing Postgres-allocated pointer is
// **not** freed since it came "::from_pg()". We don't own the underlying memory so
// we can't free it
}
Implementations
sourceimpl<T> PgBox<T, AllocatedByPostgres>
impl<T> PgBox<T, AllocatedByPostgres>
sourcepub unsafe fn from_pg(ptr: *mut T) -> PgBox<T, AllocatedByPostgres>
pub unsafe fn from_pg(ptr: *mut T) -> PgBox<T, AllocatedByPostgres>
Box a pointer that cames from Postgres.
When this PgBox<T>
is dropped, the boxed memory is not freed. Since Postgres
allocated it, Postgres is responsible for freeing it.
sourceimpl<T> PgBox<T, AllocatedByRust>
impl<T> PgBox<T, AllocatedByRust>
sourcepub fn new(val: T) -> PgBox<T, AllocatedByRust>
pub fn new(val: T) -> PgBox<T, AllocatedByRust>
Allocates memory in PostgreSQL and then places val
into it.
This value is managed by Rust, so gets dropped via normal Drop
semantics.
If you need to give the boxed pointer to Postgres, call .into_pg()
.
use pgx::{PgBox, AllocatedByRust};
let ptr: PgBox<i32, AllocatedByRust> = PgBox::new(5);
assert_eq!(*ptr, 5);
let mut ptr: PgBox<Vec<i32>, AllocatedByRust> = PgBox::new(vec![]);
assert_eq!(*ptr, Vec::<i32>::default());
ptr.push(1);
assert_eq!(*ptr, vec![1]);
ptr.push(2);
assert_eq!(*ptr, vec![1, 2]);
ptr.push(3);
assert_eq!(*ptr, vec![1, 2, 3]);
let drained = ptr.drain(..).collect::<Vec<_>>();
assert_eq!(drained, vec![1, 2, 3])
sourcepub fn new_in_context(
val: T,
memory_context: PgMemoryContexts
) -> PgBox<T, AllocatedByRust>
pub fn new_in_context(
val: T,
memory_context: PgMemoryContexts
) -> PgBox<T, AllocatedByRust>
Allocates memory in PostgreSQL and then places val
into it.
This value is managed by Rust, so gets dropped via normal Drop
semantics.
If you need to give the boxed pointer to Postgres, call .into_pg()
.
use pgx::{PgBox, PgMemoryContexts, AllocatedByRust};
let ptr: PgBox<i32, AllocatedByRust> = PgBox::new_in_context(5, PgMemoryContexts::CurrentMemoryContext);
assert_eq!(*ptr, 5);
sourceimpl<T, AllocatedBy: WhoAllocated<T>> PgBox<T, AllocatedBy>
impl<T, AllocatedBy: WhoAllocated<T>> PgBox<T, AllocatedBy>
sourcepub unsafe fn from_rust(ptr: *mut T) -> PgBox<T, AllocatedByRust>
pub unsafe fn from_rust(ptr: *mut T) -> PgBox<T, AllocatedByRust>
Box a pointer that was allocated within Rust
When this PgBox<T>
is dropped, the boxed memory is freed. Since Rust
allocated it, Rust is responsible for freeing it.
If you need to give the boxed pointer to Postgres, call .into_pg()
sourcepub fn alloc() -> PgBox<T, AllocatedByRust>
pub fn alloc() -> PgBox<T, AllocatedByRust>
Allocate enough memory for the type’d struct, within Postgres’ CurrentMemoryContext
The
allocated memory is uninitialized.
When this object is dropped the backing memory will be pfree’d,
unless it is instead turned into_pg()
, at which point it will be freeded
when its owning MemoryContext is deleted by Postgres (likely transaction end).
Examples
use pgx::{PgBox, pg_sys};
let ctid = PgBox::<pg_sys::ItemPointerData>::alloc();
sourcepub fn alloc0() -> PgBox<T, AllocatedByRust>
pub fn alloc0() -> PgBox<T, AllocatedByRust>
Allocate enough memory for the type’d struct, within Postgres’ CurrentMemoryContext
The
allocated memory is zero-filled.
When this object is dropped the backing memory will be pfree’d,
unless it is instead turned into_pg()
, at which point it will be freeded
when its owning MemoryContext is deleted by Postgres (likely transaction end).
Examples
use pgx::{PgBox, pg_sys};
let ctid = PgBox::<pg_sys::ItemPointerData>::alloc0();
sourcepub fn alloc_in_context(
memory_context: PgMemoryContexts
) -> PgBox<T, AllocatedByRust>
pub fn alloc_in_context(
memory_context: PgMemoryContexts
) -> PgBox<T, AllocatedByRust>
Allocate enough memory for the type’d struct, within the specified Postgres MemoryContext. The allocated memory is uninitalized.
When this object is dropped the backing memory will be pfree’d,
unless it is instead turned into_pg()
, at which point it will be freeded
when its owning MemoryContext is deleted by Postgres (likely transaction end).
Examples
use pgx::{PgBox, pg_sys, PgMemoryContexts};
let ctid = PgBox::<pg_sys::ItemPointerData>::alloc_in_context(PgMemoryContexts::TopTransactionContext);
sourcepub fn alloc0_in_context(
memory_context: PgMemoryContexts
) -> PgBox<T, AllocatedByRust>
pub fn alloc0_in_context(
memory_context: PgMemoryContexts
) -> PgBox<T, AllocatedByRust>
Allocate enough memory for the type’d struct, within the specified Postgres MemoryContext. The allocated memory is zero-filled.
When this object is dropped the backing memory will be pfree’d,
unless it is instead turned into_pg()
, at which point it will be freeded
when its owning MemoryContext is deleted by Postgres (likely transaction end).
Examples
use pgx::{PgBox, pg_sys, PgMemoryContexts};
let ctid = PgBox::<pg_sys::ItemPointerData>::alloc0_in_context(PgMemoryContexts::TopTransactionContext);
sourcepub fn alloc_node(node_tag: NodeTag) -> PgBox<T, AllocatedByRust>
pub fn alloc_node(node_tag: NodeTag) -> PgBox<T, AllocatedByRust>
Allocate a Postgres pg_sys::Node
subtype, using palloc
in the CurrentMemoryContext
.
The allocated node will have it’s type_
field set to the node_tag
argument, and will
otherwise be initialized with all zeros
Examples
use pgx::{PgBox, pg_sys};
let create_trigger_statement = PgBox::<pg_sys::CreateTrigStmt>::alloc_node(pg_sys::NodeTag_T_CreateTrigStmt);
sourcepub fn null() -> PgBox<T, AllocatedByPostgres>
pub fn null() -> PgBox<T, AllocatedByPostgres>
Box nothing
sourcepub fn as_ptr(&self) -> *mut T
pub fn as_ptr(&self) -> *mut T
Return the boxed pointer, so that it can be passed back into a Postgres function
sourcepub fn into_pg(self) -> *mut T
pub fn into_pg(self) -> *mut T
Useful for returning the boxed pointer back to Postgres (as a return value, for example).
The boxed pointer is not free’d by Rust
sourcepub fn into_pg_boxed(self) -> PgBox<T, AllocatedByPostgres>
pub fn into_pg_boxed(self) -> PgBox<T, AllocatedByPostgres>
Useful for returning the boxed pointer back to Postgres (as a return value, for example).
The boxed pointer is not free’d by Rust
Trait Implementations
sourceimpl<T, AllocatedBy: WhoAllocated<T>> Deref for PgBox<T, AllocatedBy>
impl<T, AllocatedBy: WhoAllocated<T>> Deref for PgBox<T, AllocatedBy>
sourceimpl<T, AllocatedBy: WhoAllocated<T>> DerefMut for PgBox<T, AllocatedBy>
impl<T, AllocatedBy: WhoAllocated<T>> DerefMut for PgBox<T, AllocatedBy>
sourceimpl<T, AllocatedBy: WhoAllocated<T>> Drop for PgBox<T, AllocatedBy>
impl<T, AllocatedBy: WhoAllocated<T>> Drop for PgBox<T, AllocatedBy>
sourceimpl<T> FromDatum for PgBox<T, AllocatedByPostgres>
impl<T> FromDatum for PgBox<T, AllocatedByPostgres>
for user types
const NEEDS_TYPID: bool
sourceunsafe fn from_datum(datum: Datum, is_null: bool, _: Oid) -> Option<Self>ⓘNotable traits for Option<L>impl<L, S> Layer<S> for Option<L> where
L: Layer<S>,
S: Subscriber,
unsafe fn from_datum(datum: Datum, is_null: bool, _: Oid) -> Option<Self>ⓘNotable traits for Option<L>impl<L, S> Layer<S> for Option<L> where
L: Layer<S>,
S: Subscriber,
L: Layer<S>,
S: Subscriber,
Safety Read more
sourceunsafe fn from_datum_in_memory_context(
memory_context: PgMemoryContexts,
datum: usize,
is_null: bool,
_typoid: u32
) -> Option<Self>ⓘNotable traits for Option<L>impl<L, S> Layer<S> for Option<L> where
L: Layer<S>,
S: Subscriber,
where
Self: Sized,
unsafe fn from_datum_in_memory_context(
memory_context: PgMemoryContexts,
datum: usize,
is_null: bool,
_typoid: u32
) -> Option<Self>ⓘNotable traits for Option<L>impl<L, S> Layer<S> for Option<L> where
L: Layer<S>,
S: Subscriber,
where
Self: Sized,
L: Layer<S>,
S: Subscriber,
Default implementation switched to the specified memory context and then simply calls
From::from_datum(...)
from within that context. Read more
sourceimpl<T, AllocatedBy: WhoAllocated<T>> IntoDatum for PgBox<T, AllocatedBy>
impl<T, AllocatedBy: WhoAllocated<T>> IntoDatum for PgBox<T, AllocatedBy>
for user types
fn into_datum(self) -> Option<Datum>ⓘNotable traits for Option<L>impl<L, S> Layer<S> for Option<L> where
L: Layer<S>,
S: Subscriber,
L: Layer<S>,
S: Subscriber,
fn type_oid() -> Oid
fn array_type_oid() -> Oid
Auto Trait Implementations
impl<T, AllocatedBy> RefUnwindSafe for PgBox<T, AllocatedBy> where
AllocatedBy: RefUnwindSafe,
T: RefUnwindSafe,
impl<T, AllocatedBy = AllocatedByPostgres> !Send for PgBox<T, AllocatedBy>
impl<T, AllocatedBy = AllocatedByPostgres> !Sync for PgBox<T, AllocatedBy>
impl<T, AllocatedBy> Unpin for PgBox<T, AllocatedBy> where
AllocatedBy: Unpin,
impl<T, AllocatedBy> UnwindSafe for PgBox<T, AllocatedBy> where
AllocatedBy: UnwindSafe,
T: RefUnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>ⓘNotable traits for Instrumented<T>impl<T> Future for Instrumented<T> where
T: Future, type Output = <T as Future>::Output;
fn instrument(self, span: Span) -> Instrumented<Self>ⓘNotable traits for Instrumented<T>impl<T> Future for Instrumented<T> where
T: Future, type Output = <T as Future>::Output;
T: Future, type Output = <T as Future>::Output;
sourcefn in_current_span(self) -> Instrumented<Self>ⓘNotable traits for Instrumented<T>impl<T> Future for Instrumented<T> where
T: Future, type Output = <T as Future>::Output;
fn in_current_span(self) -> Instrumented<Self>ⓘNotable traits for Instrumented<T>impl<T> Future for Instrumented<T> where
T: Future, type Output = <T as Future>::Output;
T: Future, type Output = <T as Future>::Output;
impl<D> OwoColorize for D
impl<D> OwoColorize for D
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self> where
C: Color,
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,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self> where
C: Color,
Set the background color generically. Read more
fn black(&'a self) -> FgColorDisplay<'a, Black, Self>
fn black(&'a self) -> FgColorDisplay<'a, Black, Self>
Change the foreground color to black
fn on_black(&'a self) -> BgColorDisplay<'a, Black, Self>
fn on_black(&'a self) -> BgColorDisplay<'a, Black, Self>
Change the background color to black
fn red(&'a self) -> FgColorDisplay<'a, Red, Self>
fn red(&'a self) -> FgColorDisplay<'a, Red, Self>
Change the foreground color to red
fn on_red(&'a self) -> BgColorDisplay<'a, Red, Self>
fn on_red(&'a self) -> BgColorDisplay<'a, Red, Self>
Change the background color to red
fn green(&'a self) -> FgColorDisplay<'a, Green, Self>
fn green(&'a self) -> FgColorDisplay<'a, Green, Self>
Change the foreground color to green
fn on_green(&'a self) -> BgColorDisplay<'a, Green, Self>
fn on_green(&'a self) -> BgColorDisplay<'a, Green, Self>
Change the background color to green
fn yellow(&'a self) -> FgColorDisplay<'a, Yellow, Self>
fn yellow(&'a self) -> FgColorDisplay<'a, Yellow, Self>
Change the foreground color to yellow
fn on_yellow(&'a self) -> BgColorDisplay<'a, Yellow, Self>
fn on_yellow(&'a self) -> BgColorDisplay<'a, Yellow, Self>
Change the background color to yellow
fn blue(&'a self) -> FgColorDisplay<'a, Blue, Self>
fn blue(&'a self) -> FgColorDisplay<'a, Blue, Self>
Change the foreground color to blue
fn on_blue(&'a self) -> BgColorDisplay<'a, Blue, Self>
fn on_blue(&'a self) -> BgColorDisplay<'a, Blue, Self>
Change the background color to blue
fn magenta(&'a self) -> FgColorDisplay<'a, Magenta, Self>
fn magenta(&'a self) -> FgColorDisplay<'a, Magenta, Self>
Change the foreground color to magenta
fn on_magenta(&'a self) -> BgColorDisplay<'a, Magenta, Self>
fn on_magenta(&'a self) -> BgColorDisplay<'a, Magenta, Self>
Change the background color to magenta
fn purple(&'a self) -> FgColorDisplay<'a, Magenta, Self>
fn purple(&'a self) -> FgColorDisplay<'a, Magenta, Self>
Change the foreground color to purple
fn on_purple(&'a self) -> BgColorDisplay<'a, Magenta, Self>
fn on_purple(&'a self) -> BgColorDisplay<'a, Magenta, Self>
Change the background color to purple
fn cyan(&'a self) -> FgColorDisplay<'a, Cyan, Self>
fn cyan(&'a self) -> FgColorDisplay<'a, Cyan, Self>
Change the foreground color to cyan
fn on_cyan(&'a self) -> BgColorDisplay<'a, Cyan, Self>
fn on_cyan(&'a self) -> BgColorDisplay<'a, Cyan, Self>
Change the background color to cyan
fn white(&'a self) -> FgColorDisplay<'a, White, Self>
fn white(&'a self) -> FgColorDisplay<'a, White, Self>
Change the foreground color to white
fn on_white(&'a self) -> BgColorDisplay<'a, White, Self>
fn on_white(&'a self) -> BgColorDisplay<'a, White, Self>
Change the background color to white
fn default_color(&'a self) -> FgColorDisplay<'a, Default, Self>
fn default_color(&'a self) -> FgColorDisplay<'a, Default, Self>
Change the foreground color to the terminal default
fn on_default_color(&'a self) -> BgColorDisplay<'a, Default, Self>
fn on_default_color(&'a self) -> BgColorDisplay<'a, Default, Self>
Change the background color to the terminal default
fn bright_black(&'a self) -> FgColorDisplay<'a, BrightBlack, Self>
fn bright_black(&'a self) -> FgColorDisplay<'a, BrightBlack, Self>
Change the foreground color to bright black
fn on_bright_black(&'a self) -> BgColorDisplay<'a, BrightBlack, Self>
fn on_bright_black(&'a self) -> BgColorDisplay<'a, BrightBlack, Self>
Change the background color to bright black
fn bright_red(&'a self) -> FgColorDisplay<'a, BrightRed, Self>
fn bright_red(&'a self) -> FgColorDisplay<'a, BrightRed, Self>
Change the foreground color to bright red
fn on_bright_red(&'a self) -> BgColorDisplay<'a, BrightRed, Self>
fn on_bright_red(&'a self) -> BgColorDisplay<'a, BrightRed, Self>
Change the background color to bright red
fn bright_green(&'a self) -> FgColorDisplay<'a, BrightGreen, Self>
fn bright_green(&'a self) -> FgColorDisplay<'a, BrightGreen, Self>
Change the foreground color to bright green
fn on_bright_green(&'a self) -> BgColorDisplay<'a, BrightGreen, Self>
fn on_bright_green(&'a self) -> BgColorDisplay<'a, BrightGreen, Self>
Change the background color to bright green
fn bright_yellow(&'a self) -> FgColorDisplay<'a, BrightYellow, Self>
fn bright_yellow(&'a self) -> FgColorDisplay<'a, BrightYellow, Self>
Change the foreground color to bright yellow
fn on_bright_yellow(&'a self) -> BgColorDisplay<'a, BrightYellow, Self>
fn on_bright_yellow(&'a self) -> BgColorDisplay<'a, BrightYellow, Self>
Change the background color to bright yellow
fn bright_blue(&'a self) -> FgColorDisplay<'a, BrightBlue, Self>
fn bright_blue(&'a self) -> FgColorDisplay<'a, BrightBlue, Self>
Change the foreground color to bright blue
fn on_bright_blue(&'a self) -> BgColorDisplay<'a, BrightBlue, Self>
fn on_bright_blue(&'a self) -> BgColorDisplay<'a, BrightBlue, Self>
Change the background color to bright blue
fn bright_magenta(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
fn bright_magenta(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
Change the foreground color to bright magenta
fn on_bright_magenta(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
fn on_bright_magenta(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
Change the background color to bright magenta
fn bright_purple(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
fn bright_purple(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
Change the foreground color to bright purple
fn on_bright_purple(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
fn on_bright_purple(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
Change the background color to bright purple
fn bright_cyan(&'a self) -> FgColorDisplay<'a, BrightCyan, Self>
fn bright_cyan(&'a self) -> FgColorDisplay<'a, BrightCyan, Self>
Change the foreground color to bright cyan
fn on_bright_cyan(&'a self) -> BgColorDisplay<'a, BrightCyan, Self>
fn on_bright_cyan(&'a self) -> BgColorDisplay<'a, BrightCyan, Self>
Change the background color to bright cyan
fn bright_white(&'a self) -> FgColorDisplay<'a, BrightWhite, Self>
fn bright_white(&'a self) -> FgColorDisplay<'a, BrightWhite, Self>
Change the foreground color to bright white
fn on_bright_white(&'a self) -> BgColorDisplay<'a, BrightWhite, Self>
fn on_bright_white(&'a self) -> BgColorDisplay<'a, BrightWhite, Self>
Change the background color to bright white
fn bold(&'a self) -> BoldDisplay<'a, Self>
fn bold(&'a self) -> BoldDisplay<'a, Self>
Make the text bold
fn dimmed(&'a self) -> DimDisplay<'a, Self>
fn dimmed(&'a self) -> DimDisplay<'a, Self>
Make the text dim
fn italic(&'a self) -> ItalicDisplay<'a, Self>
fn italic(&'a self) -> ItalicDisplay<'a, Self>
Make the text italicized
fn underline(&'a self) -> UnderlineDisplay<'a, Self>
fn underline(&'a self) -> UnderlineDisplay<'a, Self>
Make the text italicized
fn blink(&'a self) -> BlinkDisplay<'a, Self>
fn blink(&'a self) -> BlinkDisplay<'a, Self>
Make the text blink
fn blink_fast(&'a self) -> BlinkFastDisplay<'a, Self>
fn blink_fast(&'a self) -> BlinkFastDisplay<'a, Self>
Make the text blink (but fast!)
fn reversed(&'a self) -> ReversedDisplay<'a, Self>
fn reversed(&'a self) -> ReversedDisplay<'a, Self>
Swap the foreground and background colors
Hide the text
fn strikethrough(&'a self) -> StrikeThroughDisplay<'a, Self>
fn strikethrough(&'a self) -> StrikeThroughDisplay<'a, Self>
Cross out the text
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self> where
Color: DynColor,
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,
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>
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>
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>
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>
fn on_truecolor(&self, r: u8, g: u8, b: u8) -> BgDynColorDisplay<'_, Rgb, Self>
Sets the background color to an RGB value.
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
pub fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>ⓘNotable traits for WithDispatch<T>impl<T> Future for WithDispatch<T> where
T: Future, type Output = <T as Future>::Output;
where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>ⓘNotable traits for WithDispatch<T>impl<T> Future for WithDispatch<T> where
T: Future, type Output = <T as Future>::Output;
where
S: Into<Dispatch>,
T: Future, type Output = <T as Future>::Output;
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>ⓘNotable traits for WithDispatch<T>impl<T> Future for WithDispatch<T> where
T: Future, type Output = <T as Future>::Output;
fn with_current_subscriber(self) -> WithDispatch<Self>ⓘNotable traits for WithDispatch<T>impl<T> Future for WithDispatch<T> where
T: Future, type Output = <T as Future>::Output;
T: Future, type Output = <T as Future>::Output;
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more