pub struct Builder<'client, 'builder, D: ?Sized + 'builder> { /* private fields */ }
Expand description
Builds a Cursor
This type is constructed by calling Cursor::build
.
Implementations§
Source§impl<'client, 'builder, D: Display + ?Sized + 'builder> Builder<'client, 'builder, D>
impl<'client, 'builder, D: Display + ?Sized + 'builder> Builder<'client, 'builder, D>
Sourcepub fn query_params(
self,
params: &'builder [&'builder (dyn ToSql + Sync)],
) -> Self
pub fn query_params( self, params: &'builder [&'builder (dyn ToSql + Sync)], ) -> Self
Set query params for cursor creation
Sourcepub fn batch_size(self, batch_size: u32) -> Self
pub fn batch_size(self, batch_size: u32) -> Self
Set the batch size passed to FETCH
on each iteration.
Default is 5,000.
Sourcepub fn tag<D2: Display + ?Sized>(
self,
tag: &'builder D2,
) -> Builder<'client, 'builder, D2>
pub fn tag<D2: Display + ?Sized>( self, tag: &'builder D2, ) -> Builder<'client, 'builder, D2>
Set the tag for cursor name.
Adding a tag to the cursor name can be helpful for identifying where
cursors originate when viewing pg_stat_activity
.
Default is default
.
§Examples
Any type that implements fmt::Display
may be provided as a tag. For example, a simple
string literal is one option.
let mut cursor = Cursor::build(&mut client)
.tag("custom-cursor-tag")
.finalize();
Or maybe you want to build a tag at run-time without incurring an extra allocation:
use std::fmt;
struct Pid(i32);
impl fmt::Display for Pid {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "pid-{}", self.0)
}
}
let tag = Pid(8123);
let mut cursor = Cursor::build(&mut client)
.tag(&tag)
.finalize();
Auto Trait Implementations§
impl<'client, 'builder, D> Freeze for Builder<'client, 'builder, D>where
D: ?Sized,
impl<'client, 'builder, D> !RefUnwindSafe for Builder<'client, 'builder, D>
impl<'client, 'builder, D> Send for Builder<'client, 'builder, D>
impl<'client, 'builder, D> !Sync for Builder<'client, 'builder, D>
impl<'client, 'builder, D> Unpin for Builder<'client, 'builder, D>where
D: ?Sized,
impl<'client, 'builder, D> !UnwindSafe for Builder<'client, 'builder, D>
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