pub struct ConfigBuilder { /* private fields */ }Expand description
bililive stream config builder.
Stream config can be built via given live room parameters (room id and user id) & danmaku server configs (server token and list).
§Helper methods
by_uid fetches room id by given user id.
fetch_conf fetches danmaku server token and list without any input parameter.
§Example
ConfigBuilder::new()
.by_uid(1472906636)
.await?
.fetch_conf()
.await?
.build()Implementations§
Source§impl ConfigBuilder
impl ConfigBuilder
pub fn new() -> Self
pub const fn room_id(self, room_id: u64) -> Self
pub const fn uid(self, uid: u64) -> Self
pub fn token(self, token: &str) -> Self
pub fn servers(self, servers: &[String]) -> Self
Sourcepub async fn by_uid(self, uid: u64) -> Result<Self>
pub async fn by_uid(self, uid: u64) -> Result<Self>
Fills room_id and uid by given uid, fetching room_id automatically.
§Errors
Returns an error when HTTP api request fails.
Sourcepub async fn fetch_conf(self) -> Result<Self>
pub async fn fetch_conf(self) -> Result<Self>
Sourcepub fn build(self) -> Result<StreamConfig>
pub fn build(self) -> Result<StreamConfig>
Trait Implementations§
Source§impl Debug for ConfigBuilder
impl Debug for ConfigBuilder
Source§impl Default for ConfigBuilder
impl Default for ConfigBuilder
Source§fn default() -> ConfigBuilder
fn default() -> ConfigBuilder
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for ConfigBuilder
impl !RefUnwindSafe for ConfigBuilder
impl Send for ConfigBuilder
impl Sync for ConfigBuilder
impl Unpin for ConfigBuilder
impl !UnwindSafe for ConfigBuilder
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