[−][src]Struct pgx::stringinfo::StringInfo
StringInfoData holds information about an extensible string that is allocated by Postgres' memory system, but generally follows Rust's drop semantics
Implementations
impl StringInfo
[src]
pub fn new() -> Self
[src]
Construct a new StringInfo
of its default size, allocated by Postgres in CurrentMemoryContext
Unless .into_pg()
or .into_char_ptr()
are called, memory management of
this StringInfo
follow Rust's drop semantics.
pub fn with_capacity(len: usize) -> Self
[src]
Construct a new StringInfo
, allocated by Postgres in CurrentMemoryContext
, ensuring it
has a capacity of the specified len
.
Note that Postgres can only represent up to 1 gigabyte of data in a StringInfo
Unless .into_pg()
or .into_char_ptr()
are called, memory management of
this StringInfo
follow Rust's drop semantics.
pub fn from_pg(sid: StringInfo) -> Option<Self>
[src]
Construct a StringInfo
from a Postgres-allocated pg_sys::StringInfo
.
The backing pg_sys::StringInfo
structure will be freed whenever the memory context in which
it was originally allocated is reset.
pub fn len(&self) -> usize
[src]
What is the length, excluding the trailing null byte
pub fn is_empty(&self) -> bool
[src]
Do we have any characters?
pub fn push(&mut self, ch: char)
[src]
Push a Rust character onto the end. A Rust char
could be 4 bytes in total, so it
is converted into a String first to ensure unicode correctness
pub fn push_str(&mut self, s: &str)
[src]
Push a String reference onto the end
pub fn push_bytes(&mut self, bytes: &[u8])
[src]
Push arbitrary bytes onto the end. Any byte sequence is allowed, include those with embedded NULLs
pub fn push_raw(&mut self, ptr: void_mut_ptr, len: usize)
[src]
Push the bytes behind a raw pointer of a given length onto the end
pub fn reset(&mut self)
[src]
Reset the size of the StringInfo
back to zero-length. This does/// not* free any
previously-allocated memory
pub fn enlarge(&mut self, needed: usize)
[src]
Ensure that this StringInfo
is at least needed
bytes long
pub fn as_ptr(&self) -> *mut c_char
[src]
A pointer representation
pub fn as_bytes(&self) -> &[u8]
[src]
A &[u8]
byte slice representation
pub fn as_bytes_mut(&mut self) -> &mut [u8]
[src]
A mutable &[u8]
byte slice representation
pub fn into_pg(mut self: Self) -> *mut StringInfoData
[src]
Convert this StringInfo
into one that is wholly owned and now managed by Postgres
pub fn into_char_ptr(mut self: Self) -> *const c_char
[src]
Convert this StringInfo
into a "char *"
that is wholly owned and now managed by Postgres
Trait Implementations
impl Default for StringInfo
[src]
impl Drop for StringInfo
[src]
impl From<&'_ [u8]> for StringInfo
[src]
impl From<&'_ str> for StringInfo
[src]
impl From<String> for StringInfo
[src]
impl From<Vec<u8, Global>> for StringInfo
[src]
impl Into<&'static CStr> for StringInfo
[src]
impl Into<*mut StringInfoData> for StringInfo
[src]
pub fn into(self) -> StringInfo
[src]
impl ToString for StringInfo
[src]
impl Write for StringInfo
[src]
pub fn write(&mut self, buf: &[u8]) -> Result<usize, Error>
[src]
pub fn flush(&mut self) -> Result<(), Error>
[src]
pub fn write_vectored(&mut self, bufs: &[IoSlice<'_>]) -> Result<usize, Error>
1.36.0[src]
pub fn is_write_vectored(&self) -> bool
[src]
pub fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
1.0.0[src]
pub fn write_all_vectored(
&mut self,
bufs: &mut [IoSlice<'_>]
) -> Result<(), Error>
[src]
&mut self,
bufs: &mut [IoSlice<'_>]
) -> Result<(), Error>
pub fn write_fmt(&mut self, fmt: Arguments<'_>) -> Result<(), Error>
1.0.0[src]
pub fn by_ref(&mut self) -> &mut Self
1.0.0[src]
Auto Trait Implementations
impl RefUnwindSafe for StringInfo
[src]
impl !Send for StringInfo
[src]
impl !Sync for StringInfo
[src]
impl Unpin for StringInfo
[src]
impl UnwindSafe for StringInfo
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,