pub struct MediaId(/* private fields */);Expand description
Bilibili media ID.
Implementations§
Source§impl MediaId
impl MediaId
Sourcepub fn new(value: u64) -> BpiResult<Self>
pub fn new(value: u64) -> BpiResult<Self>
Creates a non-zero numeric ID.
Examples found in repository?
examples/module_clients.rs (line 12)
9async fn main() -> BpiResult<()> {
10 let client = client_from_env()?;
11 let video_params = VideoViewParams::from_bvid("BV1xx411c7mD".parse::<Bvid>()?);
12 let bangumi_params = BangumiInfoParams::new(MediaId::new(28_220_978)?);
13
14 if !run_live_example() {
15 println!("module-client quickstart compiled; set BPI_RUN_EXAMPLE=1 to call live APIs");
16 return Ok(());
17 }
18
19 let video = client.video().view(video_params).await?;
20 println!("video: {}", video.title);
21
22 let bangumi = client.bangumi().info(bangumi_params).await?;
23 println!("bangumi: {}", bangumi.media.title);
24
25 if env::var_os("BPI_COOKIE").is_some() {
26 let nav = client.login().nav().await?;
27 println!("logged in: {}", nav.is_login);
28 }
29
30 Ok(())
31}Trait Implementations§
impl Copy for MediaId
Source§impl<'de> Deserialize<'de> for MediaId
impl<'de> Deserialize<'de> for MediaId
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
impl Eq for MediaId
Source§impl Ord for MediaId
impl Ord for MediaId
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialOrd for MediaId
impl PartialOrd for MediaId
impl StructuralPartialEq for MediaId
Auto Trait Implementations§
impl Freeze for MediaId
impl RefUnwindSafe for MediaId
impl Send for MediaId
impl Sync for MediaId
impl Unpin for MediaId
impl UnsafeUnpin for MediaId
impl UnwindSafe for MediaId
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> RuleType for T
Source§impl<T> Serialize for T
impl<T> Serialize for T
fn erased_serialize(&self, serializer: &mut dyn Serializer) -> Result<(), Error>
fn do_erased_serialize( &self, serializer: &mut dyn Serializer, ) -> Result<(), ErrorImpl>
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.