src/duration.rs

kube · kube-core/src/duration.rs · rust · Apache-2.0
infra

Rust wrapper for Kubernetes durations, supporting parsing, formatting, and negative values.

// Source: https://github.com/kube-rs/kube | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
// Provided via justclaw.it.com; keep this notice with the code.
//! Kubernetes [`Duration`]s.
use serde::{Deserialize, Deserializer, Serialize, Serializer, de};
#[cfg(feature = "schema")] use std::borrow::Cow;
use std::{cmp::Ordering, fmt, str::FromStr, time};

/// A Kubernetes duration.
///
/// This is equivalent to the [`metav1.Duration`] type in the Go Kubernetes
/// apimachinery package. A [`metav1.Duration`] is serialized in YAML and JSON
/// as a string formatted in the format accepted by the Go standard library's
/// [`time.ParseDuration()`] function. This type is a similar wrapper around
/// Rust's [`std::time::Duration`] that can be serialized a

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key