pub struct NullString {
pub string: Option<String>,
pub valid: Option<bool>,
}Expand description
NullString : var s NullString err := db.QueryRow("SELECT name FROM foo WHERE id=?", id).Scan(&s) … if s.Valid { use s.String } else { NULL value }
Fields§
§string: Option<String>§valid: Option<bool>Implementations§
Source§impl NullString
impl NullString
Sourcepub fn new() -> NullString
pub fn new() -> NullString
var s NullString err := db.QueryRow("SELECT name FROM foo WHERE id=?", id).Scan(&s) … if s.Valid { use s.String } else { NULL value }
Trait Implementations§
Source§impl Clone for NullString
impl Clone for NullString
Source§fn clone(&self) -> NullString
fn clone(&self) -> NullString
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for NullString
impl Debug for NullString
Source§impl Default for NullString
impl Default for NullString
Source§fn default() -> NullString
fn default() -> NullString
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for NullString
impl<'de> Deserialize<'de> for NullString
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for NullString
impl PartialEq for NullString
Source§fn eq(&self, other: &NullString) -> bool
fn eq(&self, other: &NullString) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for NullString
impl Serialize for NullString
impl StructuralPartialEq for NullString
Auto Trait Implementations§
impl Freeze for NullString
impl RefUnwindSafe for NullString
impl Send for NullString
impl Sync for NullString
impl Unpin for NullString
impl UnsafeUnpin for NullString
impl UnwindSafe for NullString
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