Struct SqliteConnection
pub struct SqliteConnection { /* private fields */ }Expand description
Connections for the SQLite backend. Unlike other backends, SQLite supported connection URLs are:
- File paths (
test.db) - URIs (
file://test.db) - Special identifiers (
:memory:)
§Supported loading model implementations
- [
DefaultLoadingMode]
As SqliteConnection only supports a single loading mode implementation,
it is not required to explicitly specify a loading mode
when calling RunQueryDsl::load_iter() or [LoadConnection::load]
§DefaultLoadingMode
SqliteConnection only supports a single loading mode, which loads
values row by row from the result set.
use diesel::connection::DefaultLoadingMode;
{
// scope to restrict the lifetime of the iterator
let iter1 = users::table.load_iter::<(i32, String), DefaultLoadingMode>(connection)?;
for r in iter1 {
let (id, name) = r?;
println!("Id: {} Name: {}", id, name);
}
}
// works without specifying the loading mode
let iter2 = users::table.load_iter::<(i32, String), _>(connection)?;
for r in iter2 {
let (id, name) = r?;
println!("Id: {} Name: {}", id, name);
}This mode does not support creating multiple iterators using the same connection.
use diesel::connection::DefaultLoadingMode;
let iter1 = users::table.load_iter::<(i32, String), DefaultLoadingMode>(connection)?;
let iter2 = users::table.load_iter::<(i32, String), DefaultLoadingMode>(connection)?;
for r in iter1 {
let (id, name) = r?;
println!("Id: {} Name: {}", id, name);
}
for r in iter2 {
let (id, name) = r?;
println!("Id: {} Name: {}", id, name);
}§Concurrency
By default, when running into a database lock, the operation will abort with a
Database locked error. However, it’s possible to configure it for greater concurrency,
trading latency for not having to deal with retries yourself.
You can use this example as blue-print for which statements to run after establishing a connection.
It is important to run each PRAGMA in a single statement to make sure all of them apply
correctly. In addition the order of the PRAGMA statements is relevant to prevent timeout
issues for the later PRAGMA statements.
use diesel::connection::SimpleConnection;
let conn = &mut establish_connection();
// see https://fractaledmind.github.io/2023/09/07/enhancing-rails-sqlite-fine-tuning/
// sleep if the database is busy, this corresponds to up to 2 seconds sleeping time.
conn.batch_execute("PRAGMA busy_timeout = 2000;")?;
// better write-concurrency
conn.batch_execute("PRAGMA journal_mode = WAL;")?;
// fsync only in critical moments
conn.batch_execute("PRAGMA synchronous = NORMAL;")?;
// write WAL changes back every 1000 pages, for an in average 1MB WAL file.
// May affect readers if number is increased
conn.batch_execute("PRAGMA wal_autocheckpoint = 1000;")?;
// free some space by truncating possibly massive WAL files from the last run
conn.batch_execute("PRAGMA wal_checkpoint(TRUNCATE);")?;Implementations§
§impl SqliteConnection
impl SqliteConnection
pub fn immediate_transaction<T, E, F>(&mut self, f: F) -> Result<T, E>
pub fn immediate_transaction<T, E, F>(&mut self, f: F) -> Result<T, E>
Run a transaction with BEGIN IMMEDIATE
This method will return an error if a transaction is already open.
§Example
conn.immediate_transaction(|conn| {
// Do stuff in a transaction
Ok(())
})pub fn exclusive_transaction<T, E, F>(&mut self, f: F) -> Result<T, E>
pub fn exclusive_transaction<T, E, F>(&mut self, f: F) -> Result<T, E>
Run a transaction with BEGIN EXCLUSIVE
This method will return an error if a transaction is already open.
§Example
conn.exclusive_transaction(|conn| {
// Do stuff in a transaction
Ok(())
})pub fn register_collation<F>(
&mut self,
collation_name: &str,
collation: F,
) -> Result<(), Error>
pub fn register_collation<F>( &mut self, collation_name: &str, collation: F, ) -> Result<(), Error>
Register a collation function.
collation must always return the same answer given the same inputs.
If collation panics and unwinds the stack, the process is aborted, since it is used
across a C FFI boundary, which cannot be unwound across and there is no way to
signal failures via the SQLite interface in this case..
If the name is already registered it will be overwritten.
This method will return an error if registering the function fails, either due to an out-of-memory situation or because a collation with that name already exists and is currently being used in parallel by a query.
The collation needs to be specified when creating a table:
CREATE TABLE my_table ( str TEXT COLLATE MY_COLLATION ),
where MY_COLLATION corresponds to name passed as collation_name.
§Example
// sqlite NOCASE only works for ASCII characters,
// this collation allows handling UTF-8 (barring locale differences)
conn.register_collation("RUSTNOCASE", |rhs, lhs| {
rhs.to_lowercase().cmp(&lhs.to_lowercase())
})pub fn serialize_database_to_buffer(&mut self) -> SerializedDatabase
pub fn serialize_database_to_buffer(&mut self) -> SerializedDatabase
Serialize the current SQLite database into a byte buffer.
The serialized data is identical to the data that would be written to disk if the database was saved in a file.
§Returns
This function returns a byte slice representing the serialized database.
pub fn deserialize_readonly_database_from_buffer(
&mut self,
data: &[u8],
) -> Result<(), Error>
pub fn deserialize_readonly_database_from_buffer( &mut self, data: &[u8], ) -> Result<(), Error>
Deserialize an SQLite database from a byte buffer.
This function takes a byte slice and attempts to deserialize it into a SQLite database. If successful, the database is loaded into the connection. If the deserialization fails, an error is returned.
The database is opened in READONLY mode.
§Example
let connection = &mut SqliteConnection::establish(":memory:").unwrap();
sql_query("CREATE TABLE users (id INTEGER PRIMARY KEY, name TEXT, email TEXT)")
.execute(connection).unwrap();
sql_query("INSERT INTO users (name, email) VALUES ('John Doe', 'john.doe@example.com'), ('Jane Doe', 'jane.doe@example.com')")
.execute(connection).unwrap();
// Serialize the database to a byte vector
let serialized_db: SerializedDatabase = connection.serialize_database_to_buffer();
// Create a new in-memory SQLite database
let connection = &mut SqliteConnection::establish(":memory:").unwrap();
// Deserialize the byte vector into the new database
connection.deserialize_readonly_database_from_buffer(serialized_db.as_slice()).unwrap();pub fn deserialize_database_from_buffer( &mut self, data: &[u8], ) -> Result<(), Error>
Trait Implementations§
§impl Connection for SqliteConnection
impl Connection for SqliteConnection
§fn establish(database_url: &str) -> Result<SqliteConnection, ConnectionError>
fn establish(database_url: &str) -> Result<SqliteConnection, ConnectionError>
Establish a connection to the database specified by database_url.
See SqliteConnection for supported database_url.
If the database does not exist, this method will try to create a new database and then establish a connection to it.
§WASM support
If you plan to use this connection type on the wasm32-unknown-unknown target please
make sure to read the following notes:
- The database is stored in memory by default.
- Persistent VFS (Virtual File Systems) is optional, see https://github.com/Spxg/sqlite-wasm-rs/blob/master/sqlite-wasm-rs/src/vfs/README.md for details
§fn set_instrumentation(&mut self, instrumentation: impl Instrumentation)
fn set_instrumentation(&mut self, instrumentation: impl Instrumentation)
Instrumentation] implementation for this connection§fn set_prepared_statement_cache_size(&mut self, size: CacheSize)
fn set_prepared_statement_cache_size(&mut self, size: CacheSize)
CacheSize] for this connection§fn transaction<T, E, F>(&mut self, f: F) -> Result<T, E>
fn transaction<T, E, F>(&mut self, f: F) -> Result<T, E>
§fn begin_test_transaction(&mut self) -> Result<(), Error>
fn begin_test_transaction(&mut self) -> Result<(), Error>
Source§impl CustomizeConnection<SqliteConnection, Error> for EncryptedConnection
impl CustomizeConnection<SqliteConnection, Error> for EncryptedConnection
Source§fn on_acquire(&self, conn: &mut SqliteConnection) -> Result<(), Error>
fn on_acquire(&self, conn: &mut SqliteConnection) -> Result<(), Error>
ManageConnection::connect. Read moreSource§fn on_release(&self, conn: C)
fn on_release(&self, conn: C)
Source§impl CustomizeConnection<SqliteConnection, Error> for NopConnection
impl CustomizeConnection<SqliteConnection, Error> for NopConnection
Source§fn on_acquire(&self, c: &mut SqliteConnection) -> Result<(), Error>
fn on_acquire(&self, c: &mut SqliteConnection) -> Result<(), Error>
ManageConnection::connect. Read moreSource§fn on_release(&self, conn: C)
fn on_release(&self, conn: C)
Source§impl CustomizeConnection<SqliteConnection, Error> for UnencryptedConnection
impl CustomizeConnection<SqliteConnection, Error> for UnencryptedConnection
Source§fn on_acquire(&self, c: &mut SqliteConnection) -> Result<(), Error>
fn on_acquire(&self, c: &mut SqliteConnection) -> Result<(), Error>
ManageConnection::connect. Read moreSource§fn on_release(&self, conn: C)
fn on_release(&self, conn: C)
§impl LoadConnection for SqliteConnection
impl LoadConnection for SqliteConnection
§impl MigrationConnection for SqliteConnection
Available on crate feature sqlite only.
impl MigrationConnection for SqliteConnection
sqlite only.§impl R2D2Connection for SqliteConnection
Available on crate feature r2d2 only.
impl R2D2Connection for SqliteConnection
r2d2 only.§impl SimpleConnection for SqliteConnection
impl SimpleConnection for SqliteConnection
§impl<'b, Changes, Output> UpdateAndFetchResults<Changes, Output> for SqliteConnectionwhere
Changes: Copy + Identifiable + AsChangeset<Target = <Changes as HasTable>::Table> + IntoUpdateTarget,
<Changes as HasTable>::Table: FindDsl<<Changes as Identifiable>::Id>,
UpdateStatement<<Changes as HasTable>::Table, <Changes as IntoUpdateTarget>::WhereClause, <Changes as AsChangeset>::Changeset>: ExecuteDsl<SqliteConnection>,
<<Changes as HasTable>::Table as FindDsl<<Changes as Identifiable>::Id>>::Output: LoadQuery<'b, SqliteConnection, Output>,
<<Changes as HasTable>::Table as Table>::AllColumns: ValidGrouping<()>,
<<<Changes as HasTable>::Table as Table>::AllColumns as ValidGrouping<()>>::IsAggregate: MixedAggregates<No, Output = No>,
Available on crate feature sqlite only.
impl<'b, Changes, Output> UpdateAndFetchResults<Changes, Output> for SqliteConnectionwhere
Changes: Copy + Identifiable + AsChangeset<Target = <Changes as HasTable>::Table> + IntoUpdateTarget,
<Changes as HasTable>::Table: FindDsl<<Changes as Identifiable>::Id>,
UpdateStatement<<Changes as HasTable>::Table, <Changes as IntoUpdateTarget>::WhereClause, <Changes as AsChangeset>::Changeset>: ExecuteDsl<SqliteConnection>,
<<Changes as HasTable>::Table as FindDsl<<Changes as Identifiable>::Id>>::Output: LoadQuery<'b, SqliteConnection, Output>,
<<Changes as HasTable>::Table as Table>::AllColumns: ValidGrouping<()>,
<<<Changes as HasTable>::Table as Table>::AllColumns as ValidGrouping<()>>::IsAggregate: MixedAggregates<No, Output = No>,
sqlite only.§fn update_and_fetch(&mut self, changeset: Changes) -> Result<Output, Error>
fn update_and_fetch(&mut self, changeset: Changes) -> Result<Output, Error>
§impl WithMetadataLookup for SqliteConnection
impl WithMetadataLookup for SqliteConnection
§fn metadata_lookup(&mut self) -> &mut <Sqlite as TypeMetadata>::MetadataLookup
fn metadata_lookup(&mut self) -> &mut <Sqlite as TypeMetadata>::MetadataLookup
impl Send for SqliteConnection
Auto Trait Implementations§
impl Freeze for SqliteConnection
impl !RefUnwindSafe for SqliteConnection
impl !Sync for SqliteConnection
impl Unpin for SqliteConnection
impl !UnwindSafe for SqliteConnection
Blanket Implementations§
§impl<T> AggregateExpressionMethods for T
impl<T> AggregateExpressionMethods for T
§fn aggregate_distinct(self) -> Self::Outputwhere
Self: DistinctDsl,
fn aggregate_distinct(self) -> Self::Outputwhere
Self: DistinctDsl,
DISTINCT modifier for aggregate functions Read more§fn aggregate_all(self) -> Self::Outputwhere
Self: AllDsl,
fn aggregate_all(self) -> Self::Outputwhere
Self: AllDsl,
ALL modifier for aggregate functions Read more§fn aggregate_filter<P>(self, f: P) -> Self::Outputwhere
P: AsExpression<Bool>,
Self: FilterDsl<<P as AsExpression<Bool>>::Expression>,
fn aggregate_filter<P>(self, f: P) -> Self::Outputwhere
P: AsExpression<Bool>,
Self: FilterDsl<<P as AsExpression<Bool>>::Expression>,
§fn aggregate_order<O>(self, o: O) -> Self::Outputwhere
Self: OrderAggregateDsl<O>,
fn aggregate_order<O>(self, o: O) -> Self::Outputwhere
Self: OrderAggregateDsl<O>,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Classify for T
impl<T> Classify for T
type Classified = T
fn classify(self) -> T
§impl<T> Conv for T
impl<T> Conv for T
§impl<T> Declassify for T
impl<T> Declassify for T
type Declassified = T
fn declassify(self) -> T
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSend for T
impl<T> DowncastSend for T
§impl<T> FmtForward for T
impl<T> FmtForward for T
§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.§fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<T> IntoSql for T
impl<T> IntoSql for T
§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].§impl<C, DB> MigrationHarness<DB> for Cwhere
DB: Backend + DieselReserveSpecialization,
C: Connection<Backend = DB> + MigrationConnection + 'static,
table: BoxedDsl<'static, DB, Output = BoxedSelectStatement<'static, (Text, Timestamp), FromClause<table>, DB>>,
BoxedSelectStatement<'static, Text, FromClause<table>, DB>: LoadQuery<'static, C, MigrationVersion<'static>>,
DefaultValues: QueryFragment<DB>,
str: ToSql<Text, DB>,
impl<C, DB> MigrationHarness<DB> for Cwhere
DB: Backend + DieselReserveSpecialization,
C: Connection<Backend = DB> + MigrationConnection + 'static,
table: BoxedDsl<'static, DB, Output = BoxedSelectStatement<'static, (Text, Timestamp), FromClause<table>, DB>>,
BoxedSelectStatement<'static, Text, FromClause<table>, DB>: LoadQuery<'static, C, MigrationVersion<'static>>,
DefaultValues: QueryFragment<DB>,
str: ToSql<Text, DB>,
§fn run_migration(
&mut self,
migration: &dyn Migration<DB>,
) -> Result<MigrationVersion<'static>, Box<dyn Error + Send + Sync>>
fn run_migration( &mut self, migration: &dyn Migration<DB>, ) -> Result<MigrationVersion<'static>, Box<dyn Error + Send + Sync>>
§fn revert_migration(
&mut self,
migration: &dyn Migration<DB>,
) -> Result<MigrationVersion<'static>, Box<dyn Error + Send + Sync>>
fn revert_migration( &mut self, migration: &dyn Migration<DB>, ) -> Result<MigrationVersion<'static>, Box<dyn Error + Send + Sync>>
§fn applied_migrations(
&mut self,
) -> Result<Vec<MigrationVersion<'static>>, Box<dyn Error + Send + Sync>>
fn applied_migrations( &mut self, ) -> Result<Vec<MigrationVersion<'static>>, Box<dyn Error + Send + Sync>>
§fn has_pending_migration<S>(
&mut self,
source: S,
) -> Result<bool, Box<dyn Error + Send + Sync>>where
S: MigrationSource<DB>,
fn has_pending_migration<S>(
&mut self,
source: S,
) -> Result<bool, Box<dyn Error + Send + Sync>>where
S: MigrationSource<DB>,
§fn run_pending_migrations<S>(
&mut self,
source: S,
) -> Result<Vec<MigrationVersion<'_>>, Box<dyn Error + Send + Sync>>where
S: MigrationSource<DB>,
fn run_pending_migrations<S>(
&mut self,
source: S,
) -> Result<Vec<MigrationVersion<'_>>, Box<dyn Error + Send + Sync>>where
S: MigrationSource<DB>,
§fn run_next_migration<S>(
&mut self,
source: S,
) -> Result<MigrationVersion<'_>, Box<dyn Error + Send + Sync>>where
S: MigrationSource<DB>,
fn run_next_migration<S>(
&mut self,
source: S,
) -> Result<MigrationVersion<'_>, Box<dyn Error + Send + Sync>>where
S: MigrationSource<DB>,
§fn revert_all_migrations<S>(
&mut self,
source: S,
) -> Result<Vec<MigrationVersion<'_>>, Box<dyn Error + Send + Sync>>where
S: MigrationSource<DB>,
fn revert_all_migrations<S>(
&mut self,
source: S,
) -> Result<Vec<MigrationVersion<'_>>, Box<dyn Error + Send + Sync>>where
S: MigrationSource<DB>,
§fn revert_last_migration<S>(
&mut self,
source: S,
) -> Result<MigrationVersion<'static>, Box<dyn Error + Send + Sync>>where
S: MigrationSource<DB>,
fn revert_last_migration<S>(
&mut self,
source: S,
) -> Result<MigrationVersion<'static>, Box<dyn Error + Send + Sync>>where
S: MigrationSource<DB>,
§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,
§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
§fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
§fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
§fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
§fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
§fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
§fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
§fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
§fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
§fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
§fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
§fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
§fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
§fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
§fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
§fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
§fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
§fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
§fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
§fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
§fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
§fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
§fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
§fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
§fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
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,
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>
§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>
§fn truecolor(&self, r: u8, g: u8, b: u8) -> FgDynColorDisplay<'_, Rgb, Self>
fn truecolor(&self, r: u8, g: u8, b: u8) -> FgDynColorDisplay<'_, Rgb, Self>
§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>
§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
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) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
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
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
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
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
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
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§impl<T> Tap for T
impl<T> Tap for T
§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read more§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read more§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read more§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read more§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read more§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read more§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.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
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.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
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.