A library for writing host-specific, single-binary configuration management and deployment tools
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
608 B

4 years ago
  1. use crate::resources::Resource;
  2. pub trait ToArtifact {
  3. type Artifact;
  4. }
  5. macro_rules! to_artifact {
  6. ( $($name:ident)* ) => (
  7. #[allow(non_snake_case)]
  8. impl<$($name: Resource,)*> ToArtifact for ($($name,)*)
  9. {
  10. type Artifact = ($($name::Artifact,)*);
  11. }
  12. );
  13. }
  14. for_each_tuple!(to_artifact);
  15. impl<T: Resource> ToArtifact for Option<T> {
  16. // FIXME: https://github.com/rust-lang/rust-clippy/issues/2843
  17. #![allow(clippy::use_self)]
  18. type Artifact = Option<T::Artifact>;
  19. }
  20. impl<T: Resource> ToArtifact for T {
  21. type Artifact = <Self as Resource>::Artifact;
  22. }