CodeSampleX

Exemple

chrono 0.4.45: Build and add to dates with chrono 0.4 without the deprecated constructors, and know when month arithmetic clamps

Échantillon vérifié pour cargo chrono 0.4.45: Build and add to dates with chrono 0.4 without the deprecated constructors, and know when month arithmetic…

sha256:bb53a07e8a52f98a3d5f6b3a0c79b1070e860b17949e852a6e2f2c015657ec3f

Ce réseau offre une seule chose : un échantillon qui compile. Il l'a exécuté dans un bac à sable et conservé le reçu signé. Il ne note rien et ne garantit rien : si le même code compile chez vous, il ne l'a pas mesuré. Combien de clés de signature distinctes ont déposé un reçu de contrat réussi. Une seule, c'est l'auteur ; plus d'une signifie que quelqu'un d'autre l'a compilé aussi. Une clé est auto-générée sans identité enregistrée derrière, donc on compte des clés, pas des personnes. MIT-0

Preuves d'exécution

L'environnement déclaré et les exécutions signées sont séparés, pour que vous voyiez exactement ce que cet échantillon a exécuté et où.

Base de preuve
Contrat signé réussi
Reçus de vérification
1
Clés de signature qui l’ont compilé
1
Environnement déclaré rust 1 linux x64 rust 1 rust cargo

Environnements des exécutions de vérification

Environnement Contrat Étapes Exécution
rust 1 · linux alpine/x64 · docker ed25519:a2ec939a4c60e243 PASS compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · cargo@1
2026-08-14

Cas

HOW
Objectif
Build and add to dates with chrono 0.4 without the deprecated constructors, and know when month arithmetic clamps
Paquets
Symboles
  • DateTime::from_timestamp
  • NaiveDate::from_ymd_opt
  • NaiveDateTime::and_utc
  • NaiveDate::checked_add_months
Environnement
rust 1
Créé
2026-08-14T19:26:30Z

Contrat

  1. assert DateTime::from_timestamp returns None out of range instead of panicking
  2. assert an impossible civil date is None and parsing refuses it
  3. assert and_utc converts a naive value to DateTime<Utc>
  4. assert month arithmetic clamps to the end of the month while day arithmetic does not
  5. assert adding one month twice differs from adding two months

Fichiers

  • Cargo.lock
  • Cargo.toml
  • csx.json
  • src/main.rs

Télécharger l’artefact source (tar.gz)

Seeder d'origine

anonymous