Skip to content
jdm edited this page Apr 15, 2013 · 4 revisions

We follow the Rust coding conventions. Additional Servo-specific conventions follow.

Platform specific code

Each crate contains it's own platform-specific code - we don't have a single platform abstraction layer for all of servo.

some_crate/mod.rs
some_crate/platform/$(port_name)/mod.rs

$(port_name) is generally the same as a #[cfg(target_os = "...")] string.

If not inside platform, you never access platform::$(port_name)::mod, you access platform::mod. Within the platform module, we use conditional compilation, mostly with #[cfg(target_os = "...")] to make symbols appear in the right place. If we find ourselves with multiple ports for a single os we will use the custom port_name cfg item to identify them and modify the build as appropriate.

DOM code

Specification name == TypeName

dom/lowercasespecname.rs => implementation

dom/bindings/lowercasespecname.rs => manual bindings goop

dom/bindings/codegen/specname_bindings.rs => codegen bindings goop