Struct teloxide_tests::MockMessageAudio

source ·
pub struct MockMessageAudio {
Show 27 fields pub id: MessageId, pub thread_id: Option<i32>, pub date: DateTime<Utc>, pub chat: Chat, pub via_bot: Option<User>, pub from: Option<User>, pub sender_chat: Option<Chat>, pub author_signature: Option<String>, pub forward: Option<Forward>, pub reply_to_message: Option<Box<Message>>, pub edit_date: Option<DateTime<Utc>>, pub reply_markup: Option<InlineKeyboardMarkup>, pub is_topic_message: bool, pub is_automatic_forward: bool, pub has_protected_content: bool, pub caption: Option<String>, pub caption_entities: Vec<MessageEntity>, pub media_group_id: Option<String>, pub duration: u32, pub performer: Option<String>, pub title: Option<String>, pub thumb: Option<PhotoSize>, pub file_name: Option<String>, pub mime_type: Option<Mime>, pub file_id: String, pub file_unique_id: String, pub file_size: u32,
}

Fields§

§id: MessageId§thread_id: Option<i32>§date: DateTime<Utc>§chat: Chat§via_bot: Option<User>§from: Option<User>§sender_chat: Option<Chat>§author_signature: Option<String>§forward: Option<Forward>§reply_to_message: Option<Box<Message>>§edit_date: Option<DateTime<Utc>>§reply_markup: Option<InlineKeyboardMarkup>§is_topic_message: bool§is_automatic_forward: bool§has_protected_content: bool§caption: Option<String>§caption_entities: Vec<MessageEntity>§media_group_id: Option<String>§duration: u32§performer: Option<String>§title: Option<String>§thumb: Option<PhotoSize>§file_name: Option<String>§mime_type: Option<Mime>§file_id: String§file_unique_id: String§file_size: u32

Implementations§

source§

impl MockMessageAudio

source

pub fn id(self, value: i32) -> Self

Sets the id value of the MockMessageAudio to value, converting it to MessageId.

§Example
use teloxide_tests::MockMessageAudio;
let builder = MockMessageAudio::new().id(1234);
assert_eq!(builder.id, teloxide::types::MessageId(1234));
source

pub fn thread_id<T: Into<i32>>(self, value: T) -> Self

Sets the thread_id value of the MockMessageAudio to value, converting it to needed Option type.

source

pub fn date(self, value: DateTime<Utc>) -> Self

Sets the date value of the MockMessageAudio to value.

source

pub fn chat(self, value: Chat) -> Self

Sets the chat value of the MockMessageAudio to value.

source

pub fn via_bot<T: Into<User>>(self, value: T) -> Self

Sets the via_bot value of the MockMessageAudio to value, converting it to needed Option type.

source

pub fn from<T: Into<User>>(self, value: T) -> Self

Sets the from value of the MockMessageAudio to value, converting it to needed Option type.

source

pub fn sender_chat<T: Into<Chat>>(self, value: T) -> Self

Sets the sender_chat value of the MockMessageAudio to value, converting it to needed Option type.

source

pub fn author_signature<T: Into<String>>(self, value: T) -> Self

Sets the author_signature value of the MockMessageAudio to value, converting it to needed Option type.

source

pub fn forward<T: Into<Forward>>(self, value: T) -> Self

Sets the forward value of the MockMessageAudio to value, converting it to needed Option type.

source

pub fn reply_to_message<T: Into<Box<Message>>>(self, value: T) -> Self

Sets the reply_to_message value of the MockMessageAudio to value, converting it to needed Option type.

source

pub fn edit_date<T: Into<DateTime<Utc>>>(self, value: T) -> Self

Sets the edit_date value of the MockMessageAudio to value, converting it to needed Option type.

source

pub fn reply_markup<T: Into<InlineKeyboardMarkup>>(self, value: T) -> Self

Sets the reply_markup value of the MockMessageAudio to value, converting it to needed Option type.

source

pub fn is_topic_message(self, value: bool) -> Self

Sets the is_topic_message value of the MockMessageAudio to value.

source

pub fn is_automatic_forward(self, value: bool) -> Self

Sets the is_automatic_forward value of the MockMessageAudio to value.

source

pub fn has_protected_content(self, value: bool) -> Self

Sets the has_protected_content value of the MockMessageAudio to value.

source

pub fn caption<T: Into<String>>(self, value: T) -> Self

Sets the caption value of the MockMessageAudio to value, converting it to needed Option type.

source

pub fn caption_entities(self, value: Vec<MessageEntity>) -> Self

Sets the caption_entities value of the MockMessageAudio to value.

source

pub fn media_group_id<T: Into<String>>(self, value: T) -> Self

Sets the media_group_id value of the MockMessageAudio to value, converting it to needed Option type.

source

pub fn duration(self, value: u32) -> Self

Sets the duration value of the MockMessageAudio to value.

source

pub fn performer<T: Into<String>>(self, value: T) -> Self

Sets the performer value of the MockMessageAudio to value, converting it to needed Option type.

source

pub fn title<T: Into<String>>(self, value: T) -> Self

Sets the title value of the MockMessageAudio to value, converting it to needed Option type.

source

pub fn thumb<T: Into<PhotoSize>>(self, value: T) -> Self

Sets the thumb value of the MockMessageAudio to value, converting it to needed Option type.

source

pub fn file_name<T: Into<String>>(self, value: T) -> Self

Sets the file_name value of the MockMessageAudio to value, converting it to needed Option type.

source

pub fn mime_type<T: Into<Mime>>(self, value: T) -> Self

Sets the mime_type value of the MockMessageAudio to value, converting it to needed Option type.

source

pub fn file_id<T: Into<String>>(self, value: T) -> Self

Sets the file_id value of the MockMessageAudio to value, converting it to String.

§Example
use teloxide_tests::MockMessageAudio;
let builder = MockMessageAudio::new().file_id("test");
assert_eq!(builder.file_id, "test".to_string());
source

pub fn file_unique_id<T: Into<String>>(self, value: T) -> Self

Sets the file_unique_id value of the MockMessageAudio to value, converting it to String.

§Example
use teloxide_tests::MockMessageAudio;
let builder = MockMessageAudio::new().file_unique_id("test");
assert_eq!(builder.file_unique_id, "test".to_string());
source

pub fn file_size(self, value: u32) -> Self

Sets the file_size value of the MockMessageAudio to value.

source§

impl MockMessageAudio

source

pub const ID: i32 = 1i32

source§

impl MockMessageAudio

source

pub const IS_TOPIC_MESSAGE: bool = false

source

pub const IS_AUTOMATIC_FORWARD: bool = false

source

pub const HAS_PROTECTED_CONTENT: bool = false

source§

impl MockMessageAudio

source

pub const DURATION: u32 = 236u32

source

pub const FILE_ID: &'static str = "CQADAgADbQEAAsnrIUpNoRRNsH7_hAI"

source

pub const UNIQUE_FILE_ID: &'static str = "file_unique_id"

source

pub const FILE_SIZE: u32 = 9_507_774u32

source

pub fn new() -> Self

Creates a new easily changable message audio builder

§Example
let message = teloxide_tests::MockMessageAudio::new()
    .duration(236)
    .build();
assert_eq!(message.audio().unwrap().duration, 236);  // DURATION is a default value
source

pub fn build(self) -> Message

Builds the message audio

§Example
let mock_message = teloxide_tests::MockMessageAudio::new();
let message = mock_message.build();
assert_eq!(message.audio().unwrap().duration, teloxide_tests::MockMessageAudio::DURATION);  // DURATION is a default value

Trait Implementations§

source§

impl Clone for MockMessageAudio

source§

fn clone(&self) -> MockMessageAudio

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl IntoUpdate for MockMessageAudio

source§

fn into_update(self, id: AtomicI32) -> Vec<Update>

Converts the MockCallbackQuery into an updates vector

§Example
use teloxide_tests::IntoUpdate;
let mock_message = teloxide_tests::MockMessageText::new();
let update = mock_message.clone().into_update(1.into())[0].clone();
assert_eq!(update.id, 1);
assert_eq!(update.kind, teloxide::types::UpdateKind::Message(
    mock_message.build())
);

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> Erasable for T

source§

unsafe fn unerase(this: NonNull<Erased>) -> NonNull<T>

Unerase this erased pointer. Read more
source§

const ACK_1_1_0: bool = true

Whether this implementor has acknowledged the 1.1.0 update to unerase’s documented implementation requirements. Read more
source§

fn erase(this: NonNull<Self>) -> NonNull<Erased>

Turn this erasable pointer into an erased pointer. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more