• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

varlink / rust / 31330154543
56%

Build:
DEFAULT BRANCH: master
Ran 09 Aug 2026 06:54PM UTC
Jobs 1
Files 27
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

09 Aug 2026 06:52PM UTC coverage: 56.477% (+0.2%) from 56.305%
31330154543

push

github

web-flow
fix: generator fixes for keyword identifiers, null optionals and Default (#152)

Three `varlink_generator` fixes/improvements, found while generating
client code for systemd's `io.systemd.*` interfaces (which use `type`
and friends as field names liberally). They are bundled because they
touch the same emission sites and share one regenerated golden file —
happy to split if preferred.

## 1. Keywords that cannot be raw identifiers

The generator blindly prefixes every identifier with `r#`, but `self`,
`Self`, `crate` and `super` cannot be raw identifiers —
`syn::parse_str("r#self")` fails, so the generator panics on any
interface using them as a type, field, variant or parameter name.

New `safe_ident()` suffixes those four with `_` and pairs them with
`#[serde(rename = "...")]` so the wire name is unchanged. All other
names keep the existing `r#` treatment (no rename needed — serde already
strips the `r#` prefix).

## 2. Null optionals in custom types

Method argument and reply structs already annotate optional fields with
`#[serde(skip_serializing_if = "Option::is_none")]`, but typedef structs
don't. A minimally-populated custom type therefore serializes every
absent field as `null`, which servers may reject — systemd, for example,
treats an explicit `null` as an attempt to set a property rather than
omitting it. Typedef structs now get the same annotation.

## 3. `derive(Default)`

All generated structs and enums now derive `Default` (enums mark the
first variant `#[default]` — this only affects `Enum::default()`, never
the wire encoding). This makes sparsely-populated argument structs
ergonomic:

```rust
let ctx = UnitContext { description: Some("test".into()), ..Default::default() };
```

which matters for interfaces whose types carry dozens of optional
fields.

## Tests

`tests/org.example.complex.varlink` gains `ReservedEnum`, a `Reserved`
type and a `Baz` method exercising the non-raw-able keywords as type,
field, variant and method-parameter ... (continued)

35 of 35 new or added lines in 1 file covered. (100.0%)

3065 of 5427 relevant lines covered (56.48%)

13.93 hits per line

Jobs
ID Job ID Ran Files Coverage
1 31330154543.1 09 Aug 2026 06:54PM UTC 27
56.48
GitHub Action Run
Source Files on build 31330154543
  • Tree
  • List 27
  • Changed 1
  • Source Changed 0
  • Coverage Changed 1
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • c215bf16 on github
  • Prev Build on master (#30166081117)
  • Next Build on master (#31330589956)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc