mirror of
https://github.com/Noratrieb/dilaria.git
synced 2026-01-14 17:35:03 +01:00
don't need vendoring, just 33 free-standing lines now
This commit is contained in:
parent
6ca7ab5734
commit
7d8e5a2397
6 changed files with 13 additions and 115 deletions
7
Cargo.lock
generated
7
Cargo.lock
generated
|
|
@ -2,13 +2,6 @@
|
|||
# It is not intended for manual editing.
|
||||
version = 3
|
||||
|
||||
[[package]]
|
||||
name = "dbg-pls"
|
||||
version = "0.2.2"
|
||||
|
||||
[[package]]
|
||||
name = "dilaria"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"dbg-pls",
|
||||
]
|
||||
|
|
|
|||
|
|
@ -2,8 +2,3 @@
|
|||
name = "dilaria"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
dbg-pls = { path = "./dbg-pls" }
|
||||
|
|
|
|||
61
dbg-pls/Cargo.lock
generated
61
dbg-pls/Cargo.lock
generated
|
|
@ -1,61 +0,0 @@
|
|||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
version = 3
|
||||
|
||||
[[package]]
|
||||
name = "dbg-pls"
|
||||
version = "0.2.2"
|
||||
dependencies = [
|
||||
"itoa",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"ryu",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "itoa"
|
||||
version = "1.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1aab8fc367588b89dcee83ab0fd66b72b50b72fa1904d7095045ace2b0c81c35"
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.37"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ec757218438d5fda206afc041538b2f6d889286160d649a86a24d37e1235afd1"
|
||||
dependencies = [
|
||||
"unicode-xid",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "1.0.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a1feb54ed693b93a84e14094943b84b7c4eae204c512b7ccb95ab0c66d278ad1"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ryu"
|
||||
version = "1.0.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "73b4b750c782965c211b42f022f59af1fbceabdd026623714f104152f1ec149f"
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "1.0.91"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b683b2b825c8eef438b77c36a06dc262294da3d5a5813fac20da149241dcd44d"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"unicode-xid",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unicode-xid"
|
||||
version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3"
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
[package]
|
||||
name = "dbg-pls"
|
||||
version = "0.2.2"
|
||||
authors = ["Conrad Ludgate <conradludgate@gmail.com>"]
|
||||
edition = "2018"
|
||||
description = "Syntax aware pretty-printing debugging"
|
||||
license = "MIT"
|
||||
repository = "https://github.com/conradludgate/dbg-pls"
|
||||
readme = "README.md"
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
pub trait DebugPls {
|
||||
fn fmt(&self, f: Formatter<'_>);
|
||||
}
|
||||
|
||||
pub struct Formatter<'a> {
|
||||
_expr: &'a (),
|
||||
}
|
||||
|
||||
impl<'a> Formatter<'a> {
|
||||
}
|
||||
|
||||
impl<'a, D: DebugPls + ?Sized> DebugPls for &'a D {
|
||||
fn fmt(&self, _: Formatter<'_>) {
|
||||
}
|
||||
}
|
||||
31
src/lib.rs
31
src/lib.rs
|
|
@ -1,38 +1,33 @@
|
|||
pub trait CoolTrait {}
|
||||
|
||||
impl<'a, D: CoolTrait + ?Sized> CoolTrait for &'a D {}
|
||||
|
||||
pub fn foo(parent: Parent<'_>) {
|
||||
requires_parent_fulfill_trait(parent);
|
||||
requires_parent_fulfill_cool_trait(parent);
|
||||
}
|
||||
|
||||
pub fn requires_parent_fulfill_trait(_: impl dbg_pls::DebugPls) {}
|
||||
pub fn requires_parent_fulfill_cool_trait(_: impl CoolTrait) {}
|
||||
|
||||
pub enum Parent<'a> {
|
||||
A(&'a A<'a>),
|
||||
B(&'a B<'a>),
|
||||
}
|
||||
|
||||
impl<'a> dbg_pls::DebugPls for Parent<'a>
|
||||
impl<'a> CoolTrait for Parent<'a>
|
||||
where
|
||||
&'a A<'a>: dbg_pls::DebugPls,
|
||||
&'a B<'a>: dbg_pls::DebugPls,
|
||||
&'a A<'a>: CoolTrait,
|
||||
&'a B<'a>: CoolTrait,
|
||||
{
|
||||
fn fmt(&self, f: dbg_pls::Formatter<'_>) {}
|
||||
}
|
||||
|
||||
pub struct A<'a> {
|
||||
parent: Parent<'a>,
|
||||
}
|
||||
|
||||
impl<'a> dbg_pls::DebugPls for A<'a>
|
||||
where
|
||||
Parent<'a>: dbg_pls::DebugPls,
|
||||
{
|
||||
fn fmt(&self, f: dbg_pls::Formatter<'_>) {}
|
||||
}
|
||||
impl<'a> CoolTrait for A<'a> where Parent<'a>: CoolTrait {}
|
||||
|
||||
pub struct B<'a> {
|
||||
parent: Parent<'a>,
|
||||
}
|
||||
|
||||
impl<'a> dbg_pls::DebugPls for B<'a>
|
||||
where
|
||||
Parent<'a>: dbg_pls::DebugPls,
|
||||
{
|
||||
fn fmt(&self, f: dbg_pls::Formatter<'_>) {}
|
||||
}
|
||||
impl<'a> CoolTrait for B<'a> where Parent<'a>: CoolTrait {}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue