feat(docs): Traits now show up as part of lib

Previously, they were in an extra, oddly named crate.
Now we just make it a part of our generated codebase.

That way, traits, and common code, shows up as part of the library.
Fair enough.

This also means that the types ar not reusable.
Maybe a mixed-mode can be used if that is desired.
This commit is contained in:
Sebastian Thiel
2015-03-03 10:02:40 +01:00
parent 8dc5e2a53d
commit e164cf7366
8 changed files with 546 additions and 179 deletions

19
src/rust/cmn.rs Normal file
View File

@@ -0,0 +1,19 @@
use std::marker::MarkerTrait;
/// Identifies types which can be inserted and deleted.
/// Types with this trait are most commonly used by clients of this API.
pub trait Resource: MarkerTrait {}
/// Identifies types which are used in API responses.
pub trait ResponseResult: MarkerTrait {}
/// Identifies types which are used in API requests.
pub trait RequestResult: MarkerTrait {}
/// Identifies types which are only used as part of other types, which
/// usually are carrying the `Resource` trait.
pub trait Part: MarkerTrait {}
/// Identifies types which are only used by other types internally.
/// They have no special meaning, this trait just marks them for completeness.
pub trait NestedType: MarkerTrait {}

View File

@@ -1,27 +1,11 @@
#![feature(core)]
//! library with code shared by all generated implementations
extern crate hyper;
extern crate "rustc-serialize" as rustc_serialize;
extern crate "yup-oauth2" as oauth2;
use std::marker::MarkerTrait;
/// Identifies types which can be inserted and deleted.
/// Types with this trait are most commonly used by clients of this API.
pub trait Resource: MarkerTrait {}
/// Identifies types which are used in API responses.
pub trait ResponseResult: MarkerTrait {}
/// Identifies types which are used in API requests.
pub trait RequestResult: MarkerTrait {}
/// Identifies types which are only used as part of other types, which
/// usually are carrying the `Resource` trait.
pub trait Part: MarkerTrait {}
/// Identifies types which are only used by other types internally.
/// They have no special meaning, this trait just marks them for completeness.
pub trait NestedType: MarkerTrait {}
// just pull it in the check if it compiles
mod cmn;
/// This module is for testing only, its code is used in mako templates
#[cfg(test)]