IntoParts

Trait IntoParts 

Source
pub trait IntoParts: Sealed {
    // Required method
    fn into_parts(self) -> Vec<Part>;
}
Expand description

Conversion trait for types that can be represented as single/multiple content parts

§Implementations

  • &str → Text part
  • String → Text part
  • Part → Direct passthrough
  • Vec<T: IntoParts> → Flattened parts
  • Arrays/slices of T: IntoParts
  • Tuples of any implementations of IntoParts up-to 16 elements

§Examples

use google_ai_rs::Part;
use google_ai_rs::content::IntoParts as _;

// Single item
let parts = "hello".into_parts();

// Mixed collection
let parts = (
    "text",
    Part::blob("image/png", bytes),
    String::from("another")
).into_parts();

Required Methods§

Implementations on Foreign Types§

Source§

impl IntoParts for &str

Source§

impl IntoParts for ()

Source§

fn into_parts(self) -> Vec<Part>

This trait is implemented for tuples up to sixteen items long.

Source§

impl IntoParts for String

Source§

impl<T0> IntoParts for (T0,)
where T0: IntoParts,

Source§

fn into_parts(self) -> Vec<Part>

This trait is implemented for tuples up to sixteen items long.

Source§

impl<T0, T1> IntoParts for (T0, T1)
where T0: IntoParts, T1: IntoParts,

Source§

fn into_parts(self) -> Vec<Part>

This trait is implemented for tuples up to sixteen items long.

Source§

impl<T0, T1, T2> IntoParts for (T0, T1, T2)
where T0: IntoParts, T1: IntoParts, T2: IntoParts,

Source§

fn into_parts(self) -> Vec<Part>

This trait is implemented for tuples up to sixteen items long.

Source§

impl<T0, T1, T2, T3> IntoParts for (T0, T1, T2, T3)
where T0: IntoParts, T1: IntoParts, T2: IntoParts, T3: IntoParts,

Source§

fn into_parts(self) -> Vec<Part>

This trait is implemented for tuples up to sixteen items long.

Source§

impl<T0, T1, T2, T3, T4> IntoParts for (T0, T1, T2, T3, T4)
where T0: IntoParts, T1: IntoParts, T2: IntoParts, T3: IntoParts, T4: IntoParts,

Source§

fn into_parts(self) -> Vec<Part>

This trait is implemented for tuples up to sixteen items long.

Source§

impl<T0, T1, T2, T3, T4, T5> IntoParts for (T0, T1, T2, T3, T4, T5)
where T0: IntoParts, T1: IntoParts, T2: IntoParts, T3: IntoParts, T4: IntoParts, T5: IntoParts,

Source§

fn into_parts(self) -> Vec<Part>

This trait is implemented for tuples up to sixteen items long.

Source§

impl<T0, T1, T2, T3, T4, T5, T6> IntoParts for (T0, T1, T2, T3, T4, T5, T6)
where T0: IntoParts, T1: IntoParts, T2: IntoParts, T3: IntoParts, T4: IntoParts, T5: IntoParts, T6: IntoParts,

Source§

fn into_parts(self) -> Vec<Part>

This trait is implemented for tuples up to sixteen items long.

Source§

impl<T0, T1, T2, T3, T4, T5, T6, T7> IntoParts for (T0, T1, T2, T3, T4, T5, T6, T7)
where T0: IntoParts, T1: IntoParts, T2: IntoParts, T3: IntoParts, T4: IntoParts, T5: IntoParts, T6: IntoParts, T7: IntoParts,

Source§

fn into_parts(self) -> Vec<Part>

This trait is implemented for tuples up to sixteen items long.

Source§

impl<T0, T1, T2, T3, T4, T5, T6, T7, T8> IntoParts for (T0, T1, T2, T3, T4, T5, T6, T7, T8)
where T0: IntoParts, T1: IntoParts, T2: IntoParts, T3: IntoParts, T4: IntoParts, T5: IntoParts, T6: IntoParts, T7: IntoParts, T8: IntoParts,

Source§

fn into_parts(self) -> Vec<Part>

This trait is implemented for tuples up to sixteen items long.

Source§

impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> IntoParts for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9)
where T0: IntoParts, T1: IntoParts, T2: IntoParts, T3: IntoParts, T4: IntoParts, T5: IntoParts, T6: IntoParts, T7: IntoParts, T8: IntoParts, T9: IntoParts,

Source§

fn into_parts(self) -> Vec<Part>

This trait is implemented for tuples up to sixteen items long.

Source§

impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> IntoParts for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10)
where T0: IntoParts, T1: IntoParts, T2: IntoParts, T3: IntoParts, T4: IntoParts, T5: IntoParts, T6: IntoParts, T7: IntoParts, T8: IntoParts, T9: IntoParts, T10: IntoParts,

Source§

fn into_parts(self) -> Vec<Part>

This trait is implemented for tuples up to sixteen items long.

Source§

impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> IntoParts for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11)
where T0: IntoParts, T1: IntoParts, T2: IntoParts, T3: IntoParts, T4: IntoParts, T5: IntoParts, T6: IntoParts, T7: IntoParts, T8: IntoParts, T9: IntoParts, T10: IntoParts, T11: IntoParts,

Source§

fn into_parts(self) -> Vec<Part>

This trait is implemented for tuples up to sixteen items long.

Source§

impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> IntoParts for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12)
where T0: IntoParts, T1: IntoParts, T2: IntoParts, T3: IntoParts, T4: IntoParts, T5: IntoParts, T6: IntoParts, T7: IntoParts, T8: IntoParts, T9: IntoParts, T10: IntoParts, T11: IntoParts, T12: IntoParts,

Source§

fn into_parts(self) -> Vec<Part>

This trait is implemented for tuples up to sixteen items long.

Source§

impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> IntoParts for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13)
where T0: IntoParts, T1: IntoParts, T2: IntoParts, T3: IntoParts, T4: IntoParts, T5: IntoParts, T6: IntoParts, T7: IntoParts, T8: IntoParts, T9: IntoParts, T10: IntoParts, T11: IntoParts, T12: IntoParts, T13: IntoParts,

Source§

fn into_parts(self) -> Vec<Part>

This trait is implemented for tuples up to sixteen items long.

Source§

impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> IntoParts for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14)
where T0: IntoParts, T1: IntoParts, T2: IntoParts, T3: IntoParts, T4: IntoParts, T5: IntoParts, T6: IntoParts, T7: IntoParts, T8: IntoParts, T9: IntoParts, T10: IntoParts, T11: IntoParts, T12: IntoParts, T13: IntoParts, T14: IntoParts,

Source§

fn into_parts(self) -> Vec<Part>

This trait is implemented for tuples up to sixteen items long.

Source§

impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> IntoParts for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15)
where T0: IntoParts, T1: IntoParts, T2: IntoParts, T3: IntoParts, T4: IntoParts, T5: IntoParts, T6: IntoParts, T7: IntoParts, T8: IntoParts, T9: IntoParts, T10: IntoParts, T11: IntoParts, T12: IntoParts, T13: IntoParts, T14: IntoParts, T15: IntoParts,

Source§

fn into_parts(self) -> Vec<Part>

This trait is implemented for tuples up to sixteen items long.

Source§

impl<T: IntoParts + Clone> IntoParts for Cow<'_, T>

Source§

impl<T: IntoParts> IntoParts for Vec<T>

Source§

impl<T: IntoParts, const N: usize> IntoParts for [T; N]

Implementors§