pub struct List<T> {
pub data: Vec<T>,
pub has_more: bool,
pub total_count: Option<u64>,
pub url: String,
}
Expand description
A single page of a cursor-paginated list of an object.
For more details, see https://stripe.com/docs/api/pagination
Fields
data: Vec<T>
has_more: bool
total_count: Option<u64>
url: String
Implementations
sourceimpl<T> List<T>
impl<T> List<T>
sourcepub fn paginate<P>(self, params: P) -> ListPaginator<T, P>
pub fn paginate<P>(self, params: P) -> ListPaginator<T, P>
Examples found in repository?
examples/customer.rs (line 58)
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
async fn main() {
let secret_key = std::env::var("STRIPE_SECRET_KEY").expect("Missing STRIPE_SECRET_KEY in env");
let client = Client::new(secret_key);
let customer = Customer::create(
&client,
CreateCustomer {
name: Some("Alexander Lyon"),
email: Some("test@async-stripe.com"),
description: Some(
"A fake customer that is used to illustrate the examples in async-stripe.",
),
metadata: Some(
[("async-stripe".to_string(), "true".to_string())].iter().cloned().collect(),
),
..Default::default()
},
)
.await
.unwrap();
println!("created a customer at https://dashboard.stripe.com/test/customers/{}", customer.id);
let customer = Customer::create(
&client,
CreateCustomer {
name: Some("Someone Else"),
email: Some("test@async-stripe.com"),
description: Some(
"A fake customer that is used to illustrate the examples in async-stripe.",
),
metadata: Some(
[("async-stripe".to_string(), "true".to_string())].iter().cloned().collect(),
),
..Default::default()
},
)
.await
.unwrap();
println!("created a customer at https://dashboard.stripe.com/test/customers/{}", customer.id);
let params = ListCustomers { ..Default::default() };
let paginator = Customer::list(&client, ¶ms).await.unwrap().paginate(params);
let mut stream = paginator.stream(&client);
// get the next customer
let _next = stream.next().await.unwrap();
// or collect them
let customers = stream.try_collect::<Vec<_>>().await.unwrap();
println!("fetched {} customers: {:?}", customers.len(), customers);
}
Trait Implementations
sourceimpl<'de, T> Deserialize<'de> for List<T> where
T: Deserialize<'de>,
impl<'de, T> Deserialize<'de> for List<T> where
T: Deserialize<'de>,
sourcefn 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
Auto Trait Implementations
impl<T> RefUnwindSafe for List<T> where
T: RefUnwindSafe,
impl<T> Send for List<T> where
T: Send,
impl<T> Sync for List<T> where
T: Sync,
impl<T> Unpin for List<T> where
T: Unpin,
impl<T> UnwindSafe for List<T> where
T: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
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
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more