pub struct PgBpchar<'a>(/* private fields */);Expand description
A bpchar or char(n) value, held as written or as a row image carries it, blank-padded to
its length.
Two values are equal as bpchareq finds them under a deterministic collation, ignoring
trailing blanks (U+0020) on both sides, while a leading blank, a tab or any other whitespace
counts. That is the rule =, <>, IN and IS [NOT] DISTINCT FROM follow when the other
side is a bpchar, a varchar or an untyped literal. Against text, PostgreSQL casts the
bpchar to text instead, which PgBpchar::as_text models, and compares the result with
the text exactly.
use sql_values::postgres::PgBpchar;
let row = PgBpchar::new("ab ");
assert_eq!(row, PgBpchar::new("ab"));
assert_eq!(row, PgBpchar::new("ab "));
assert_ne!(row, PgBpchar::new(" ab"));
assert_ne!(PgBpchar::new("ab\t "), PgBpchar::new("ab"));
assert_eq!(PgBpchar::new(" "), PgBpchar::new(""));
assert_eq!(row.as_text(), "ab");
assert_ne!(row.as_text(), "ab ");
assert_eq!(row.to_string(), "ab ");Implementations§
Trait Implementations§
impl Eq for PgBpchar<'_>
Auto Trait Implementations§
impl<'a> Forget for PgBpchar<'a>
impl<'a> Freeze for PgBpchar<'a>
impl<'a> Move for PgBpchar<'a>
impl<'a> RefUnwindSafe for PgBpchar<'a>where
String: RefUnwindSafe,
impl<'a> Send for PgBpchar<'a>
impl<'a> Sync for PgBpchar<'a>
impl<'a> Unpin for PgBpchar<'a>
impl<'a> UnsafeUnpin for PgBpchar<'a>
impl<'a> UnwindSafe for PgBpchar<'a>
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
Mutably borrows from an owned value. Read more