(&self, src: &mut Source)
| 3539 | } |
| 3540 | } |
| 3541 | fn write_struct(&self, src: &mut Source) { |
| 3542 | if !self.has_any() { |
| 3543 | return; |
| 3544 | } |
| 3545 | |
| 3546 | let mut unstable_features = self.unstable_features.iter().cloned().collect::<Vec<_>>(); |
| 3547 | unstable_features.sort(); |
| 3548 | |
| 3549 | uwriteln!( |
| 3550 | src, |
| 3551 | " |
| 3552 | /// Link-time configurations. |
| 3553 | #[derive(Clone, Debug, Default)] |
| 3554 | pub struct LinkOptions {{ |
| 3555 | " |
| 3556 | ); |
| 3557 | |
| 3558 | for feature in unstable_features.iter() { |
| 3559 | let feature_rust_name = feature.to_snake_case(); |
| 3560 | uwriteln!(src, "{feature_rust_name}: bool,"); |
| 3561 | } |
| 3562 | |
| 3563 | uwriteln!(src, "}}"); |
| 3564 | uwriteln!(src, "impl LinkOptions {{"); |
| 3565 | |
| 3566 | for feature in unstable_features.iter() { |
| 3567 | let feature_rust_name = feature.to_snake_case(); |
| 3568 | uwriteln!( |
| 3569 | src, |
| 3570 | " |
| 3571 | /// Enable members marked as `@unstable(feature = {feature})` |
| 3572 | pub fn {feature_rust_name}(&mut self, enabled: bool) -> &mut Self {{ |
| 3573 | self.{feature_rust_name} = enabled; |
| 3574 | self |
| 3575 | }} |
| 3576 | " |
| 3577 | ); |
| 3578 | } |
| 3579 | |
| 3580 | uwriteln!(src, "}}"); |
| 3581 | } |
| 3582 | fn write_impl_from_world(&self, src: &mut Source, path: &str) { |
| 3583 | if !self.has_any() { |
| 3584 | return; |
no test coverage detected