pub struct SurfPoolBuilder { /* private fields */ }Expand description
The builder struct, used to create a SurfPool
Implementations§
Source§impl SurfPoolBuilder
impl SurfPoolBuilder
Sourcepub fn new(size: usize) -> Result<Self>
pub fn new(size: usize) -> Result<Self>
This function is used to create a new builder The parameter size is checked if is a valid and reasonable number It cannot be 0 or bigger than 100
use surf_pool::SurfPoolBuilder;
SurfPoolBuilder::new(3).unwrap();Sourcepub fn health_check(self, health_check: RequestBuilder) -> Self
pub fn health_check(self, health_check: RequestBuilder) -> Self
The health_check is a URL used to manage the connection It’s used to check the connection health status, as keepalive and as pre-connect URL
use surf_pool::SurfPoolBuilder;
let builder = SurfPoolBuilder::new(3)
.unwrap()
.health_check(surf::get("https://httpbin.org"));Sourcepub fn pre_connect(self, pre_connect: bool) -> Self
pub fn pre_connect(self, pre_connect: bool) -> Self
If true, the connections are established during the build phase, using the health_check. If the health_check is not defined, the pre-connection cannot be peformed, hence it will be ignored
use surf_pool::SurfPoolBuilder;
let builder = SurfPoolBuilder::new(3).
unwrap()
.health_check(surf::get("https://httpbin.org"))
.pre_connect(true);Sourcepub async fn build(self) -> SurfPool
pub async fn build(self) -> SurfPool
The build function that creates the @SurfPool If a health_check is available and pre_connect is set to true the connections are established in this function
use surf_pool::SurfPoolBuilder;
let builder = SurfPoolBuilder::new(3).
unwrap()
.health_check(surf::get("https://httpbin.org"))
.pre_connect(true);
let pool = builder.build();Trait Implementations§
Source§impl Debug for SurfPoolBuilder
impl Debug for SurfPoolBuilder
Source§impl Default for SurfPoolBuilder
impl Default for SurfPoolBuilder
Source§fn default() -> SurfPoolBuilder
fn default() -> SurfPoolBuilder
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for SurfPoolBuilder
impl !RefUnwindSafe for SurfPoolBuilder
impl Send for SurfPoolBuilder
impl !Sync for SurfPoolBuilder
impl Unpin for SurfPoolBuilder
impl !UnwindSafe for SurfPoolBuilder
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