pub struct InsertStatement { /* private fields */ }
Expand description
Insert any new rows into an existing table
§Examples
use sea_query::{tests_cfg::*, *};
let query = Query::insert()
.into_table(Glyph::Table)
.columns([Glyph::Aspect, Glyph::Image])
.values_panic([5.15.into(), "12A".into()])
.values_panic([4.21.into(), "123".into()])
.to_owned();
assert_eq!(
query.to_string(MysqlQueryBuilder),
r#"INSERT INTO `glyph` (`aspect`, `image`) VALUES (5.15, '12A'), (4.21, '123')"#
);
assert_eq!(
query.to_string(PostgresQueryBuilder),
r#"INSERT INTO "glyph" ("aspect", "image") VALUES (5.15, '12A'), (4.21, '123')"#
);
assert_eq!(
query.to_string(SqliteQueryBuilder),
r#"INSERT INTO "glyph" ("aspect", "image") VALUES (5.15, '12A'), (4.21, '123')"#
);
Implementations§
Source§impl InsertStatement
impl InsertStatement
Sourcepub fn new() -> InsertStatement
pub fn new() -> InsertStatement
Construct a new InsertStatement
Sourcepub fn replace(&mut self) -> &mut InsertStatement
pub fn replace(&mut self) -> &mut InsertStatement
Use REPLACE instead of INSERT
§Examples
use sea_query::{tests_cfg::*, *};
let query = Query::insert()
.replace()
.into_table(Glyph::Table)
.columns([Glyph::Aspect, Glyph::Image])
.values_panic([5.15.into(), "12A".into()])
.to_owned();
assert_eq!(
query.to_string(MysqlQueryBuilder),
r#"REPLACE INTO `glyph` (`aspect`, `image`) VALUES (5.15, '12A')"#
);
assert_eq!(
query.to_string(SqliteQueryBuilder),
r#"REPLACE INTO "glyph" ("aspect", "image") VALUES (5.15, '12A')"#
);
Sourcepub fn into_table<T>(&mut self, tbl_ref: T) -> &mut InsertStatementwhere
T: IntoTableRef,
pub fn into_table<T>(&mut self, tbl_ref: T) -> &mut InsertStatementwhere
T: IntoTableRef,
Sourcepub fn columns<C, I>(&mut self, columns: I) -> &mut InsertStatementwhere
C: IntoIden,
I: IntoIterator<Item = C>,
pub fn columns<C, I>(&mut self, columns: I) -> &mut InsertStatementwhere
C: IntoIden,
I: IntoIterator<Item = C>,
Sourcepub fn select_from<S>(
&mut self,
select: S,
) -> Result<&mut InsertStatement, Error>where
S: Into<SelectStatement>,
pub fn select_from<S>(
&mut self,
select: S,
) -> Result<&mut InsertStatement, Error>where
S: Into<SelectStatement>,
Specify a select query whose values to be inserted.
§Examples
use sea_query::{tests_cfg::*, *};
let query = Query::insert()
.into_table(Glyph::Table)
.columns([Glyph::Aspect, Glyph::Image])
.select_from(Query::select()
.column(Glyph::Aspect)
.column(Glyph::Image)
.from(Glyph::Table)
.and_where(Expr::col(Glyph::Image).like("0%"))
.to_owned()
)
.unwrap()
.to_owned();
assert_eq!(
query.to_string(MysqlQueryBuilder),
r#"INSERT INTO `glyph` (`aspect`, `image`) SELECT `aspect`, `image` FROM `glyph` WHERE `image` LIKE '0%'"#
);
assert_eq!(
query.to_string(PostgresQueryBuilder),
r#"INSERT INTO "glyph" ("aspect", "image") SELECT "aspect", "image" FROM "glyph" WHERE "image" LIKE '0%'"#
);
assert_eq!(
query.to_string(SqliteQueryBuilder),
r#"INSERT INTO "glyph" ("aspect", "image") SELECT "aspect", "image" FROM "glyph" WHERE "image" LIKE '0%'"#
);
use sea_query::{tests_cfg::*, *};
let query = Query::insert()
.into_table(Glyph::Table)
.columns([Glyph::Image])
.select_from(
Query::select()
.expr(Expr::val("hello"))
.cond_where(Cond::all().not().add(Expr::exists(
Query::select().expr(Expr::val("world")).to_owned(),
)))
.to_owned(),
)
.unwrap()
.to_owned();
assert_eq!(
query.to_string(SqliteQueryBuilder),
r#"INSERT INTO "glyph" ("image") SELECT 'hello' WHERE NOT EXISTS(SELECT 'world')"#
);
Sourcepub fn values<I>(&mut self, values: I) -> Result<&mut InsertStatement, Error>where
I: IntoIterator<Item = SimpleExpr>,
pub fn values<I>(&mut self, values: I) -> Result<&mut InsertStatement, Error>where
I: IntoIterator<Item = SimpleExpr>,
Specify a row of values to be inserted.
§Examples
use sea_query::{tests_cfg::*, *};
let query = Query::insert()
.into_table(Glyph::Table)
.columns([Glyph::Aspect, Glyph::Image])
.values([
2.into(),
Func::cast_as("2020-02-02 00:00:00", "DATE").into(),
])
.unwrap()
.to_owned();
assert_eq!(
query.to_string(MysqlQueryBuilder),
r#"INSERT INTO `glyph` (`aspect`, `image`) VALUES (2, CAST('2020-02-02 00:00:00' AS DATE))"#
);
assert_eq!(
query.to_string(PostgresQueryBuilder),
r#"INSERT INTO "glyph" ("aspect", "image") VALUES (2, CAST('2020-02-02 00:00:00' AS DATE))"#
);
assert_eq!(
query.to_string(SqliteQueryBuilder),
r#"INSERT INTO "glyph" ("aspect", "image") VALUES (2, CAST('2020-02-02 00:00:00' AS DATE))"#
);
Sourcepub fn values_panic<I>(&mut self, values: I) -> &mut InsertStatementwhere
I: IntoIterator<Item = SimpleExpr>,
pub fn values_panic<I>(&mut self, values: I) -> &mut InsertStatementwhere
I: IntoIterator<Item = SimpleExpr>,
Specify a row of values to be inserted, variation of InsertStatement::values
.
§Examples
use sea_query::{tests_cfg::*, *};
let query = Query::insert()
.into_table(Glyph::Table)
.columns([Glyph::Aspect, Glyph::Image])
.values_panic([2.1345.into(), "24B".into()])
.values_panic([5.15.into(), "12A".into()])
.to_owned();
assert_eq!(
query.to_string(MysqlQueryBuilder),
r#"INSERT INTO `glyph` (`aspect`, `image`) VALUES (2.1345, '24B'), (5.15, '12A')"#
);
assert_eq!(
query.to_string(PostgresQueryBuilder),
r#"INSERT INTO "glyph" ("aspect", "image") VALUES (2.1345, '24B'), (5.15, '12A')"#
);
assert_eq!(
query.to_string(SqliteQueryBuilder),
r#"INSERT INTO "glyph" ("aspect", "image") VALUES (2.1345, '24B'), (5.15, '12A')"#
);
Sourcepub fn values_from_panic<I>(
&mut self,
values_iter: impl IntoIterator<Item = I>,
) -> &mut InsertStatementwhere
I: IntoIterator<Item = SimpleExpr>,
pub fn values_from_panic<I>(
&mut self,
values_iter: impl IntoIterator<Item = I>,
) -> &mut InsertStatementwhere
I: IntoIterator<Item = SimpleExpr>,
Add rows to be inserted from an iterator, variation of InsertStatement::values_panic
.
§Examples
use sea_query::{tests_cfg::*, *};
let rows = vec![[2.1345.into(), "24B".into()], [5.15.into(), "12A".into()]];
let query = Query::insert()
.into_table(Glyph::Table)
.columns([Glyph::Aspect, Glyph::Image])
.values_from_panic(rows)
.to_owned();
assert_eq!(
query.to_string(MysqlQueryBuilder),
r#"INSERT INTO `glyph` (`aspect`, `image`) VALUES (2.1345, '24B'), (5.15, '12A')"#
);
assert_eq!(
query.to_string(PostgresQueryBuilder),
r#"INSERT INTO "glyph" ("aspect", "image") VALUES (2.1345, '24B'), (5.15, '12A')"#
);
assert_eq!(
query.to_string(SqliteQueryBuilder),
r#"INSERT INTO "glyph" ("aspect", "image") VALUES (2.1345, '24B'), (5.15, '12A')"#
);
Sourcepub fn on_conflict(&mut self, on_conflict: OnConflict) -> &mut InsertStatement
pub fn on_conflict(&mut self, on_conflict: OnConflict) -> &mut InsertStatement
ON CONFLICT expression
§Examples
OnConflict::update_columns
: Update column value of existing row with inserting value- [
OnConflict::update_values
]: Update column value of existing row with value - [
OnConflict::update_exprs
]: Update column value of existing row with expression
Sourcepub fn returning(&mut self, returning: ReturningClause) -> &mut InsertStatement
pub fn returning(&mut self, returning: ReturningClause) -> &mut InsertStatement
RETURNING expressions.
§Examples
use sea_query::{tests_cfg::*, *};
let query = Query::insert()
.into_table(Glyph::Table)
.columns([Glyph::Image])
.values_panic(["12A".into()])
.returning(Query::returning().columns([Glyph::Id]))
.to_owned();
assert_eq!(
query.to_string(MysqlQueryBuilder),
"INSERT INTO `glyph` (`image`) VALUES ('12A')"
);
assert_eq!(
query.to_string(PostgresQueryBuilder),
r#"INSERT INTO "glyph" ("image") VALUES ('12A') RETURNING "id""#
);
assert_eq!(
query.to_string(SqliteQueryBuilder),
r#"INSERT INTO "glyph" ("image") VALUES ('12A') RETURNING "id""#
);
Sourcepub fn returning_col<C>(&mut self, col: C) -> &mut InsertStatementwhere
C: IntoColumnRef,
pub fn returning_col<C>(&mut self, col: C) -> &mut InsertStatementwhere
C: IntoColumnRef,
RETURNING expressions for a column.
§Examples
use sea_query::{tests_cfg::*, *};
let query = Query::insert()
.into_table(Glyph::Table)
.columns([Glyph::Image])
.values_panic(["12A".into()])
.returning_col(Glyph::Id)
.to_owned();
assert_eq!(
query.to_string(MysqlQueryBuilder),
"INSERT INTO `glyph` (`image`) VALUES ('12A')"
);
assert_eq!(
query.to_string(PostgresQueryBuilder),
r#"INSERT INTO "glyph" ("image") VALUES ('12A') RETURNING "id""#
);
assert_eq!(
query.to_string(SqliteQueryBuilder),
r#"INSERT INTO "glyph" ("image") VALUES ('12A') RETURNING "id""#
);
Sourcepub fn returning_all(&mut self) -> &mut InsertStatement
pub fn returning_all(&mut self) -> &mut InsertStatement
RETURNING expressions all columns.
§Examples
use sea_query::{tests_cfg::*, *};
let query = Query::insert()
.into_table(Glyph::Table)
.columns([Glyph::Image])
.values_panic(["12A".into()])
.returning_all()
.to_owned();
assert_eq!(
query.to_string(MysqlQueryBuilder),
"INSERT INTO `glyph` (`image`) VALUES ('12A')"
);
assert_eq!(
query.to_string(PostgresQueryBuilder),
r#"INSERT INTO "glyph" ("image") VALUES ('12A') RETURNING *"#
);
assert_eq!(
query.to_string(SqliteQueryBuilder),
r#"INSERT INTO "glyph" ("image") VALUES ('12A') RETURNING *"#
);
Sourcepub fn with(self, clause: WithClause) -> WithQuery
pub fn with(self, clause: WithClause) -> WithQuery
Create a WithQuery by specifying a WithClause to execute this query with.
§Examples
use sea_query::{*, IntoCondition, IntoIden, tests_cfg::*};
let select = SelectStatement::new()
.columns([Glyph::Id, Glyph::Image, Glyph::Aspect])
.from(Glyph::Table)
.to_owned();
let cte = CommonTableExpression::new()
.query(select)
.column(Glyph::Id)
.column(Glyph::Image)
.column(Glyph::Aspect)
.table_name("cte")
.to_owned();
let with_clause = WithClause::new().cte(cte).to_owned();
let select = SelectStatement::new()
.columns([Glyph::Id, Glyph::Image, Glyph::Aspect])
.from("cte")
.to_owned();
let mut insert = Query::insert();
insert
.into_table(Glyph::Table)
.columns([Glyph::Id, Glyph::Image, Glyph::Aspect])
.select_from(select)
.unwrap();
let query = insert.with(with_clause);
assert_eq!(
query.to_string(MysqlQueryBuilder),
r#"WITH `cte` (`id`, `image`, `aspect`) AS (SELECT `id`, `image`, `aspect` FROM `glyph`) INSERT INTO `glyph` (`id`, `image`, `aspect`) SELECT `id`, `image`, `aspect` FROM `cte`"#
);
assert_eq!(
query.to_string(PostgresQueryBuilder),
r#"WITH "cte" ("id", "image", "aspect") AS (SELECT "id", "image", "aspect" FROM "glyph") INSERT INTO "glyph" ("id", "image", "aspect") SELECT "id", "image", "aspect" FROM "cte""#
);
assert_eq!(
query.to_string(SqliteQueryBuilder),
r#"WITH "cte" ("id", "image", "aspect") AS (SELECT "id", "image", "aspect" FROM "glyph") INSERT INTO "glyph" ("id", "image", "aspect") SELECT "id", "image", "aspect" FROM "cte""#
);
Sourcepub fn with_cte<C>(&mut self, clause: C) -> &mut InsertStatementwhere
C: Into<WithClause>,
pub fn with_cte<C>(&mut self, clause: C) -> &mut InsertStatementwhere
C: Into<WithClause>,
Create a Common Table Expression by specifying a [CommonTableExpression] or WithClause to execute this query with.
§Examples
use sea_query::{*, IntoCondition, IntoIden, tests_cfg::*};
let select = SelectStatement::new()
.columns([Glyph::Id, Glyph::Image, Glyph::Aspect])
.from(Glyph::Table)
.to_owned();
let cte = CommonTableExpression::new()
.query(select)
.column(Glyph::Id)
.column(Glyph::Image)
.column(Glyph::Aspect)
.table_name("cte")
.to_owned();
let with_clause = WithClause::new().cte(cte).to_owned();
let select = SelectStatement::new()
.columns([Glyph::Id, Glyph::Image, Glyph::Aspect])
.from("cte")
.to_owned();
let mut query = Query::insert();
query
.with_cte(with_clause)
.into_table(Glyph::Table)
.columns([Glyph::Id, Glyph::Image, Glyph::Aspect])
.select_from(select)
.unwrap();
assert_eq!(
query.to_string(MysqlQueryBuilder),
r#"WITH `cte` (`id`, `image`, `aspect`) AS (SELECT `id`, `image`, `aspect` FROM `glyph`) INSERT INTO `glyph` (`id`, `image`, `aspect`) SELECT `id`, `image`, `aspect` FROM `cte`"#
);
assert_eq!(
query.to_string(PostgresQueryBuilder),
r#"WITH "cte" ("id", "image", "aspect") AS (SELECT "id", "image", "aspect" FROM "glyph") INSERT INTO "glyph" ("id", "image", "aspect") SELECT "id", "image", "aspect" FROM "cte""#
);
assert_eq!(
query.to_string(SqliteQueryBuilder),
r#"WITH "cte" ("id", "image", "aspect") AS (SELECT "id", "image", "aspect" FROM "glyph") INSERT INTO "glyph" ("id", "image", "aspect") SELECT "id", "image", "aspect" FROM "cte""#
);
Sourcepub fn or_default_values(&mut self) -> &mut InsertStatement
pub fn or_default_values(&mut self) -> &mut InsertStatement
Insert with default values if columns and values are not supplied.
§Examples
use sea_query::{tests_cfg::*, *};
// Insert default
let query = Query::insert()
.into_table(Glyph::Table)
.or_default_values()
.to_owned();
assert_eq!(
query.to_string(MysqlQueryBuilder),
r#"INSERT INTO `glyph` VALUES ()"#
);
assert_eq!(
query.to_string(PostgresQueryBuilder),
r#"INSERT INTO "glyph" VALUES (DEFAULT)"#
);
assert_eq!(
query.to_string(SqliteQueryBuilder),
r#"INSERT INTO "glyph" DEFAULT VALUES"#
);
// Ordinary insert as columns and values are supplied
let query = Query::insert()
.into_table(Glyph::Table)
.or_default_values()
.columns([Glyph::Image])
.values_panic(["ABC".into()])
.to_owned();
assert_eq!(
query.to_string(MysqlQueryBuilder),
r#"INSERT INTO `glyph` (`image`) VALUES ('ABC')"#
);
assert_eq!(
query.to_string(PostgresQueryBuilder),
r#"INSERT INTO "glyph" ("image") VALUES ('ABC')"#
);
assert_eq!(
query.to_string(SqliteQueryBuilder),
r#"INSERT INTO "glyph" ("image") VALUES ('ABC')"#
);
Sourcepub fn or_default_values_many(&mut self, num_rows: u32) -> &mut InsertStatement
pub fn or_default_values_many(&mut self, num_rows: u32) -> &mut InsertStatement
Insert multiple rows with default values if columns and values are not supplied.
§Examples
use sea_query::{tests_cfg::*, *};
// Insert default
let query = Query::insert()
.into_table(Glyph::Table)
.or_default_values_many(3)
.to_owned();
assert_eq!(
query.to_string(MysqlQueryBuilder),
r#"INSERT INTO `glyph` VALUES (), (), ()"#
);
assert_eq!(
query.to_string(PostgresQueryBuilder),
r#"INSERT INTO "glyph" VALUES (DEFAULT), (DEFAULT), (DEFAULT)"#
);
assert_eq!(
query.to_string(SqliteQueryBuilder),
r#"INSERT INTO "glyph" DEFAULT VALUES"#
);
// Ordinary insert as columns and values are supplied
let query = Query::insert()
.into_table(Glyph::Table)
.or_default_values_many(3)
.columns([Glyph::Image])
.values_panic(["ABC".into()])
.to_owned();
assert_eq!(
query.to_string(MysqlQueryBuilder),
r#"INSERT INTO `glyph` (`image`) VALUES ('ABC')"#
);
assert_eq!(
query.to_string(PostgresQueryBuilder),
r#"INSERT INTO "glyph" ("image") VALUES ('ABC')"#
);
assert_eq!(
query.to_string(SqliteQueryBuilder),
r#"INSERT INTO "glyph" ("image") VALUES ('ABC')"#
);
Source§impl InsertStatement
impl InsertStatement
Sourcepub fn build_collect_any_into(
&self,
query_builder: &dyn QueryBuilder,
sql: &mut dyn SqlWriter,
)
pub fn build_collect_any_into( &self, query_builder: &dyn QueryBuilder, sql: &mut dyn SqlWriter, )
Sourcepub fn into_sub_query_statement(self) -> SubQueryStatement
pub fn into_sub_query_statement(self) -> SubQueryStatement
Sourcepub fn build_any(&self, query_builder: &dyn QueryBuilder) -> (String, Values)
pub fn build_any(&self, query_builder: &dyn QueryBuilder) -> (String, Values)
Sourcepub fn build_collect_any(
&self,
query_builder: &dyn QueryBuilder,
sql: &mut dyn SqlWriter,
) -> String
pub fn build_collect_any( &self, query_builder: &dyn QueryBuilder, sql: &mut dyn SqlWriter, ) -> String
Source§impl InsertStatement
impl InsertStatement
Sourcepub fn build_collect_into<T>(&self, query_builder: T, sql: &mut dyn SqlWriter)where
T: QueryBuilder,
pub fn build_collect_into<T>(&self, query_builder: T, sql: &mut dyn SqlWriter)where
T: QueryBuilder,
Sourcepub fn build_collect<T>(
&self,
query_builder: T,
sql: &mut dyn SqlWriter,
) -> Stringwhere
T: QueryBuilder,
pub fn build_collect<T>(
&self,
query_builder: T,
sql: &mut dyn SqlWriter,
) -> Stringwhere
T: QueryBuilder,
Sourcepub fn build<T>(&self, query_builder: T) -> (String, Values)where
T: QueryBuilder,
pub fn build<T>(&self, query_builder: T) -> (String, Values)where
T: QueryBuilder,
Sourcepub fn to_string<T>(&self, query_builder: T) -> Stringwhere
T: QueryBuilder,
pub fn to_string<T>(&self, query_builder: T) -> Stringwhere
T: QueryBuilder,
Trait Implementations§
Source§impl Clone for InsertStatement
impl Clone for InsertStatement
Source§fn clone(&self) -> InsertStatement
fn clone(&self) -> InsertStatement
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for InsertStatement
impl Debug for InsertStatement
Source§impl Default for InsertStatement
impl Default for InsertStatement
Source§fn default() -> InsertStatement
fn default() -> InsertStatement
Source§impl PartialEq for InsertStatement
impl PartialEq for InsertStatement
Source§impl QueryStatementBuilder for InsertStatement
impl QueryStatementBuilder for InsertStatement
Source§fn build_collect_any_into(
&self,
query_builder: &dyn QueryBuilder,
sql: &mut dyn SqlWriter,
)
fn build_collect_any_into( &self, query_builder: &dyn QueryBuilder, sql: &mut dyn SqlWriter, )
fn into_sub_query_statement(self) -> SubQueryStatement
Source§fn build_any(&self, query_builder: &dyn QueryBuilder) -> (String, Values)
fn build_any(&self, query_builder: &dyn QueryBuilder) -> (String, Values)
Source§fn build_collect_any(
&self,
query_builder: &dyn QueryBuilder,
sql: &mut dyn SqlWriter,
) -> String
fn build_collect_any( &self, query_builder: &dyn QueryBuilder, sql: &mut dyn SqlWriter, ) -> String
Source§impl QueryStatementWriter for InsertStatement
impl QueryStatementWriter for InsertStatement
fn build_collect_into<T>(&self, query_builder: T, sql: &mut dyn SqlWriter)where
T: QueryBuilder,
Source§fn to_string<T>(&self, query_builder: T) -> Stringwhere
T: QueryBuilder,
fn to_string<T>(&self, query_builder: T) -> Stringwhere
T: QueryBuilder,
Source§fn build<T>(&self, query_builder: T) -> (String, Values)where
T: QueryBuilder,
fn build<T>(&self, query_builder: T) -> (String, Values)where
T: QueryBuilder,
Source§fn build_collect<T>(&self, query_builder: T, sql: &mut dyn SqlWriter) -> Stringwhere
T: QueryBuilder,
fn build_collect<T>(&self, query_builder: T, sql: &mut dyn SqlWriter) -> Stringwhere
T: QueryBuilder,
Source§impl SqlxBinder for InsertStatement
impl SqlxBinder for InsertStatement
fn build_sqlx<T>(&self, query_builder: T) -> (String, SqlxValues)where
T: QueryBuilder,
fn build_any_sqlx( &self, query_builder: &dyn QueryBuilder, ) -> (String, SqlxValues)
Source§impl StatementBuilder for InsertStatement
impl StatementBuilder for InsertStatement
impl StructuralPartialEq for InsertStatement
Auto Trait Implementations§
impl Freeze for InsertStatement
impl !RefUnwindSafe for InsertStatement
impl Send for InsertStatement
impl Sync for InsertStatement
impl Unpin for InsertStatement
impl !UnwindSafe for InsertStatement
Blanket Implementations§
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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