Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update rustdoc adapter version in playground. #380

Merged
merged 1 commit into from
Jul 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 32 additions & 32 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion experiments/trustfall_rustdoc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ default = ["console_error_panic_hook"]
clap = { version = "3.2.8", features = ["derive"] }
trustfall_core = { path = "../../trustfall_core" }
trustfall_wasm = { path = "../../trustfall_wasm" }
trustfall-rustdoc-adapter = { version = ">=26.1.0,<26.2.0" }
trustfall-rustdoc-adapter = { version = ">=26.1.4,<26.2.0" }
serde_json = "1.0.82"
anyhow = "1.0.58"
wasm-bindgen = "0.2.80"
Expand Down
123 changes: 123 additions & 0 deletions experiments/trustfall_rustdoc/src/rustdoc_schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,11 @@ type Impl implements Item {
Methods defined in this impl.
"""
method: [Method!]

"""
Constants associated with this type that are defined in this impl.
"""
associated_constant: [AssociatedConstant!]
}

"""
Expand Down Expand Up @@ -436,7 +441,22 @@ type Trait implements Item & Importable {
"""
method: [Method!]

"""
Traits whose implementation is a prerequisite for implementing this trait.
"""
supertrait: [ImplementedTrait!]

"""
Types associated with the implementation of this trait.

For example: in the `Iterator` trait, `Iterator::Item` is an associated type.
"""
associated_type: [AssociatedType!]

"""
Constants associated with this type that are defined in this impl.
"""
associated_constant: [AssociatedConstant!]
}

"""
Expand Down Expand Up @@ -700,3 +720,106 @@ type ImplementedTrait {
"""
trait: Trait
}

"""
https://docs.rs/rustdoc-types/0.11.0/rustdoc_types/struct.Item.html
https://docs.rs/rustdoc-types/latest/rustdoc_types/enum.ItemEnum.html#variant.AssocType
"""
type AssociatedType implements Item {
# properties from Item
id: String!
crate_id: Int!

"""
The name of the associated type.

For example:
```rust
trait Iterator {
type Item; // `"Item"` is the name of the associated type
}
```
"""
name: String
docs: String
attrs: [String!]!
visibility_limit: String!

# properties for AssociatedType
"""
Whether the type is defined to have a default value.

For example:
```rust
trait IntIterator {
type Item = i64; // by default, the associated type is `i64` so this property is `true`.
}
```

Associated type defaults are currently unstable: https://github.com/rust-lang/rust/issues/29661
"""
has_default: Boolean!

# edges from Item
span: Span
attribute: [Attribute!]
}

"""
https://docs.rs/rustdoc-types/0.11.0/rustdoc_types/struct.Item.html
https://docs.rs/rustdoc-types/latest/rustdoc_types/enum.ItemEnum.html#variant.AssocConst
"""
type AssociatedConstant implements Item {
# properties from Item
id: String!
crate_id: Int!

"""
The name of the associated constant.

For example:
```rust
trait BatchIterator {
const SIZE: usize; // `"SIZE"` is the name of the associated constant
}
```
"""
name: String
docs: String
attrs: [String!]!
visibility_limit: String!

# properties for AssociatedConstant
"""
The constant's default value, if any, as a Rust literal, expression, or `"_"`.

For example:
```rust
trait BatchIterator<const MIN: usize> {
const SIZE: usize = 16; // `"16"` is the default

// `"\"batch\""` is the default, including escaped quotes
const LOG_AS: &'static str = "batch";

// "MIN" is the default, referring to the other constant's name
const MIN_SIZE: usize = MIN;
}
```

If the associated constant is on a type's inherent impl, the default
is always required to be set.

If the associated constant is set to be equal to another constant,
the default holds the name of that other constant.

If the associated constant is set by evaluating a `const` expression,
such as `2 + 2` or a `const fn` call, rustdoc's current behavior is
to show a default value of `"_"` instead of evaluating
the constant value or including the full expression.
"""
default: String

# edges from Item
span: Span
attribute: [Attribute!]
}