Skip to content

Commit

Permalink
Use Askama in cpp2 (#338)
Browse files Browse the repository at this point in the history
  • Loading branch information
sffc authored Jul 11, 2023
1 parent 19b6e41 commit ffeb2bd
Show file tree
Hide file tree
Showing 37 changed files with 745 additions and 363 deletions.
92 changes: 92 additions & 0 deletions Cargo.lock

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

12 changes: 12 additions & 0 deletions core/src/hir/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,18 @@ impl Type {
}
}

impl SelfType {
/// Returns whether the self parameter is borrowed immutably.
///
/// Curently this can only happen with opaque types.
pub fn is_immutably_borrowed(&self) -> bool {
match self {
SelfType::Opaque(opaque_path) => opaque_path.owner.mutability == Mutability::Immutable,
_ => false,
}
}
}

impl Slice {
/// Returns the [`TypeLifetime`] contained in either the `Str` or `Primitive`
/// variant.
Expand Down
1 change: 1 addition & 0 deletions feature_tests/c/include/MyEnum.h

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

2 changes: 2 additions & 0 deletions feature_tests/c/include/MyStruct.h

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

2 changes: 1 addition & 1 deletion feature_tests/c2/include/MyEnum.h

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

2 changes: 2 additions & 0 deletions feature_tests/c2/include/MyStruct.h

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

6 changes: 6 additions & 0 deletions feature_tests/cpp/docs/source/structs_ffi.rst

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

1 change: 1 addition & 0 deletions feature_tests/cpp/include/MyEnum.h

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

2 changes: 2 additions & 0 deletions feature_tests/cpp/include/MyStruct.h

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

5 changes: 5 additions & 0 deletions feature_tests/cpp/include/MyStruct.hpp

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

2 changes: 2 additions & 0 deletions feature_tests/cpp2/include/MyEnum.d.hpp

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

2 changes: 1 addition & 1 deletion feature_tests/cpp2/include/MyEnum.h

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

5 changes: 5 additions & 0 deletions feature_tests/cpp2/include/MyEnum.hpp

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

2 changes: 2 additions & 0 deletions feature_tests/cpp2/include/MyStruct.d.hpp

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

2 changes: 2 additions & 0 deletions feature_tests/cpp2/include/MyStruct.h

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

5 changes: 5 additions & 0 deletions feature_tests/cpp2/include/MyStruct.hpp

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

3 changes: 3 additions & 0 deletions feature_tests/cpp2/tests/structs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,7 @@ int main(int argc, char *argv[]) {
simple_assert_eq("struct values", s.e, 5991);
simple_assert_eq("struct values", (uint32_t)s.f, (uint32_t)U'');
simple_assert_eq("struct values", (uint32_t)s.g.AsFFI(), (uint32_t)MyEnum(MyEnum::B).AsFFI());

simple_assert_eq("enum fn", s.g.into_value(), -1);
simple_assert_eq("struct fn", s.into_a(), 17);
}
13 changes: 13 additions & 0 deletions feature_tests/dotnet/Lib/Generated/MyStruct.cs

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

3 changes: 3 additions & 0 deletions feature_tests/dotnet/Lib/Generated/RawMyStruct.cs

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

1 change: 1 addition & 0 deletions feature_tests/js/api/MyEnum.d.ts

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

4 changes: 4 additions & 0 deletions feature_tests/js/api/MyStruct.d.ts

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

11 changes: 11 additions & 0 deletions feature_tests/js/api/MyStruct.js

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

4 changes: 4 additions & 0 deletions feature_tests/js/docs/source/structs_ffi.rst

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

Loading

0 comments on commit ffeb2bd

Please sign in to comment.