This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from typing import Any, Optional | |
from urllib.parse import parse_qs, unquote | |
from pydantic import GetCoreSchemaHandler, GetJsonSchemaHandler | |
from pydantic import v1 as pydantic_v1 | |
from pydantic_core import CoreSchema, core_schema | |
from typing_extensions import Self | |
class Url(pydantic_v1.AnyUrl): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// An attribute to hide warnings for unused code. | |
#![allow(dead_code)] | |
#[derive(Debug)] | |
struct Person { | |
name: String, | |
age: u8, | |
} | |
// A unit struct |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::fmt; | |
// Tuples can be used as function arguments and as return values. | |
fn reverse(pair: (i32, bool)) -> (bool, i32) { | |
// `let` can be used to bind the members of a tuple to variables. | |
let (int_param, bool_param) = pair; | |
(bool_param, int_param) | |
} |