-
-
Notifications
You must be signed in to change notification settings - Fork 135
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(mbuild): infrastructure for method builders
Now comes the actual work of setting them up. Additionally, the docs were decluttered to show comments only were necessary. Now the code path to getting the hub is as concise as possible.
- Loading branch information
Showing
9 changed files
with
2,215 additions
and
309 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<%! | ||
from util import (put_and, rust_test_fn_invisible, rust_doc_test_norun, rust_doc_comment, | ||
rb_type, mb_type, singular, hub_type) | ||
%>\ | ||
<%namespace name="util" file="util.mako"/>\ | ||
<%namespace name="lib" file="lib.mako"/>\ | ||
|
||
## Creates a Call builder type | ||
############################################################################################### | ||
############################################################################################### | ||
<%def name="new(resource, method, c)">\ | ||
<% hub_type_name = hub_type(canonicalName) %>\ | ||
/// A builder for the *${method}* method supported by a *${singular(resource)}* resource. | ||
/// It is not used directly, but through a `${rb_type(resource)}`. | ||
/// | ||
/// # Example | ||
/// | ||
/// Instantiate a resource method builder | ||
/// | ||
<%block filter="rust_doc_test_norun, rust_doc_comment">\ | ||
${util.test_prelude()}\ | ||
<%block filter="rust_test_fn_invisible">\ | ||
${lib.test_hub(hub_type_name, comments=False)}\ | ||
// Usually you wouldn't bind this to a variable, but keep calling methods | ||
// to setup your call. | ||
// TODO: figoure out actual arguments ... | ||
// let mb = hub.${resource}().${method}(...); | ||
// Finally, execute your call and process the result | ||
// TODO: comment in once args are properly setup ! | ||
// mb.do() | ||
</%block> | ||
</%block> | ||
pub struct ${mb_type(resource, method)}<'a, C, NC, A> | ||
where NC: 'a, | ||
C: 'a, | ||
A: 'a, { | ||
hub: &'a ${hub_type_name}<C, NC, A> | ||
} | ||
impl<'a, C, NC, A> MethodBuilder for ${mb_type(resource, method)}<'a, C, NC, A> {} | ||
</%def> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters