Skip to content

Commit 2130213

Browse files
Renamed cplusplus feature to ffi (#3093)
1 parent 6c8da02 commit 2130213

File tree

6 files changed

+30
-33
lines changed

6 files changed

+30
-33
lines changed

sdk/core/azure_core_amqp/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
### Breaking Changes
88

99
- Removed non-idiomatic accessor functions from `AmqpDescribed`, `AmqpSessionOptions`, `AmqpDescribedError`, `AmqpMessage`, and `AmqpTarget`
10+
- Renamed the "cplusplus" feature to "ffi" because "ffi" is more idiomatic to Rust.
1011

1112
### Bugs Fixed
1213

sdk/core/azure_core_amqp/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ tracing-subscriber = { workspace = true, features = ["env-filter"] }
3838

3939
[features]
4040
default = ["fe2o3_amqp", "fe2o3-amqp/native-tls"]
41-
cplusplus = []
41+
ffi = []
4242
test = []
4343
fe2o3_amqp = [
4444
"dep:fe2o3-amqp",

sdk/core/azure_core_amqp/src/fe2o3/value.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ impl From<&AmqpValue> for fe2o3_amqp_types::primitives::Value {
370370
value: (&amqp_described.value).into(),
371371
}),
372372
),
373-
#[cfg(feature = "cplusplus")]
373+
#[cfg(feature = "ffi")]
374374
AmqpValue::Composite(amqp_composite) => fe2o3_amqp_types::primitives::Value::Described(
375375
Box::new(serde_amqp::described::Described {
376376
descriptor: amqp_composite.descriptor().into(),
@@ -423,7 +423,7 @@ impl From<AmqpValue> for fe2o3_amqp_types::primitives::Value {
423423
//
424424
// Iron Oxide does not directly support Composite types (they're handled via macros), so when a C++
425425
// component attempts to convert an AMQP Composite type to Iron Oxide, we convert it to a Described type
426-
#[cfg(feature = "cplusplus")]
426+
#[cfg(feature = "ffi")]
427427
AmqpValue::Composite(d) => fe2o3_amqp_types::primitives::Value::Described(Box::new(
428428
serde_amqp::described::Described {
429429
descriptor: d.descriptor().into(),
@@ -667,7 +667,7 @@ impl PartialEq<AmqpValue> for fe2o3_amqp_types::primitives::Value {
667667
fe2o3_amqp_types::primitives::Value::Described(a) => **d == **a,
668668
_ => false,
669669
},
670-
#[cfg(feature = "cplusplus")]
670+
#[cfg(feature = "ffi")]
671671
AmqpValue::Composite(_) => false,
672672

673673
AmqpValue::Decimal128(d) => match self {

sdk/core/azure_core_amqp/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ pub enum ReceiverSettleMode {
8888
}
8989

9090
/// Trait for types that can be serialized to and deserialized from a byte buffer.
91-
#[cfg(feature = "cplusplus")]
91+
#[cfg(feature = "ffi")]
9292
pub trait Serializable {
9393
/// Serializes the type into the provided byte buffer.
9494
fn serialize(&self, buffer: &mut [u8]) -> azure_core::Result<()>;
@@ -98,11 +98,11 @@ pub trait Serializable {
9898
}
9999

100100
/// Trait for types that can be deserialized from a byte buffer.
101-
#[cfg(feature = "cplusplus")]
101+
#[cfg(feature = "ffi")]
102102
pub trait Deserializable<T> {
103103
/// Deserializes the type from the provided byte buffer.
104104
fn decode(data: &[u8]) -> azure_core::Result<T>;
105105
}
106106

107-
#[cfg(feature = "cplusplus")]
107+
#[cfg(feature = "ffi")]
108108
pub use value::{AmqpComposite, AmqpDescriptor};

sdk/core/azure_core_amqp/src/messaging.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ use super::{
77
};
88
#[cfg(all(feature = "fe2o3_amqp", not(target_arch = "wasm32")))]
99
use crate::fe2o3::error::Fe2o3SerializationError;
10-
#[cfg(feature = "cplusplus")]
10+
#[cfg(feature = "ffi")]
1111
use crate::Deserializable;
12-
#[cfg(feature = "cplusplus")]
12+
#[cfg(feature = "ffi")]
1313
use azure_core::error::ErrorKind;
1414
use azure_core::{time::Duration, Result, Uuid};
1515
use typespec_macros::SafeDebug;
@@ -312,7 +312,7 @@ impl From<String> for AmqpTarget {
312312
}
313313
}
314314

315-
#[cfg(feature = "cplusplus")]
315+
#[cfg(feature = "ffi")]
316316
impl From<AmqpList> for AmqpTarget {
317317
fn from(list: AmqpList) -> Self {
318318
let mut builder = AmqpTarget::builder();
@@ -374,7 +374,7 @@ impl From<AmqpList> for AmqpTarget {
374374
}
375375
}
376376

377-
#[cfg(feature = "cplusplus")]
377+
#[cfg(feature = "ffi")]
378378
impl From<AmqpTarget> for AmqpList {
379379
fn from(target: AmqpTarget) -> Self {
380380
let mut list = vec![AmqpValue::Null; 7];
@@ -477,7 +477,7 @@ impl AmqpSource {
477477
}
478478
}
479479

480-
#[cfg(feature = "cplusplus")]
480+
#[cfg(feature = "ffi")]
481481
impl From<AmqpList> for AmqpSource {
482482
fn from(list: AmqpList) -> Self {
483483
let mut builder = AmqpSource::builder();
@@ -562,7 +562,7 @@ impl From<AmqpList> for AmqpSource {
562562
}
563563
}
564564

565-
#[cfg(feature = "cplusplus")]
565+
#[cfg(feature = "ffi")]
566566
impl From<AmqpSource> for AmqpList {
567567
fn from(source: AmqpSource) -> Self {
568568
let mut list = vec![AmqpValue::Null; 11];
@@ -661,7 +661,7 @@ impl AmqpMessageHeader {}
661661
/// See also [Amqp Header](https://docs.oasis-open.org/amqp/core/v1.0/os/amqp-core-messaging-v1.0-os.html#type-header) for more information
662662
///
663663
///
664-
#[cfg(feature = "cplusplus")]
664+
#[cfg(feature = "ffi")]
665665
impl From<AmqpList> for AmqpMessageHeader {
666666
fn from(list: AmqpList) -> Self {
667667
let mut header = AmqpMessageHeader::default();
@@ -695,7 +695,7 @@ impl From<AmqpList> for AmqpMessageHeader {
695695
}
696696
}
697697

698-
#[cfg(feature = "cplusplus")]
698+
#[cfg(feature = "ffi")]
699699
impl From<AmqpMessageHeader> for AmqpList {
700700
fn from(header: AmqpMessageHeader) -> AmqpList {
701701
let mut list = vec![AmqpValue::Null; 5];
@@ -786,7 +786,7 @@ impl AmqpMessageProperties {}
786786
/// See also [Amqp Header](https://docs.oasis-open.org/amqp/core/v1.0/os/amqp-core-messaging-v1.0-os.html#type-properties) for more information
787787
///
788788
///
789-
#[cfg(feature = "cplusplus")]
789+
#[cfg(feature = "ffi")]
790790
impl From<AmqpList> for AmqpMessageProperties {
791791
fn from(list: AmqpList) -> Self {
792792
let mut message_properties = AmqpMessageProperties::default();
@@ -886,7 +886,7 @@ impl From<AmqpList> for AmqpMessageProperties {
886886
}
887887
}
888888

889-
#[cfg(feature = "cplusplus")]
889+
#[cfg(feature = "ffi")]
890890
impl From<AmqpMessageProperties> for AmqpList {
891891
fn from(properties: AmqpMessageProperties) -> AmqpList {
892892
let mut list = vec![AmqpValue::Null; 13];
@@ -1399,7 +1399,7 @@ impl From<AmqpList> for AmqpMessage {
13991399
}
14001400
}
14011401
}
1402-
#[cfg(feature = "cplusplus")]
1402+
#[cfg(feature = "ffi")]
14031403
impl Deserializable<AmqpMessage> for AmqpMessage {
14041404
fn decode(data: &[u8]) -> azure_core::Result<AmqpMessage> {
14051405
#[cfg(all(feature = "fe2o3_amqp", not(target_arch = "wasm32")))]
@@ -2188,7 +2188,7 @@ mod tests {
21882188
assert_eq!(amqp_message, value.0);
21892189
}
21902190

2191-
#[cfg(feature = "cplusplus")]
2191+
#[cfg(feature = "ffi")]
21922192
{
21932193
let deserialized = AmqpMessage::decode(&serialized).unwrap();
21942194
assert_eq!(deserialized, message);

sdk/core/azure_core_amqp/src/value.rs

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,12 @@
44
use azure_core::Uuid;
55
use std::borrow::Borrow;
66

7-
#[cfg(feature = "cplusplus")]
7+
#[cfg(feature = "ffi")]
88
use crate::fe2o3::error::Fe2o3SerializationError;
9-
#[cfg(all(
10-
feature = "cplusplus",
11-
feature = "fe2o3_amqp",
12-
not(target_arch = "wasm32")
13-
))]
14-
#[cfg(feature = "cplusplus")]
9+
#[cfg(all(feature = "ffi", feature = "fe2o3_amqp", not(target_arch = "wasm32")))]
10+
#[cfg(feature = "ffi")]
1511
use crate::{Deserializable, Serializable};
16-
#[cfg(feature = "cplusplus")]
12+
#[cfg(feature = "ffi")]
1713
use azure_core::Result;
1814
use std::time::SystemTime;
1915

@@ -213,13 +209,13 @@ impl AmqpDescribed {
213209
/// The descriptor is used to identify the type of the value.
214210
/// The value is the actual value.
215211
#[derive(Debug, PartialEq, Clone)]
216-
#[cfg(feature = "cplusplus")]
212+
#[cfg(feature = "ffi")]
217213
pub struct AmqpComposite {
218214
descriptor: AmqpDescriptor,
219215
value: AmqpList,
220216
}
221217

222-
#[cfg(feature = "cplusplus")]
218+
#[cfg(feature = "ffi")]
223219
impl AmqpComposite {
224220
/// Creates a new AMQP Composite type.
225221
///
@@ -308,11 +304,11 @@ pub enum AmqpValue {
308304
Described(Box<AmqpDescribed>),
309305

310306
/// An AMQP composite value.
311-
#[cfg(feature = "cplusplus")]
307+
#[cfg(feature = "ffi")]
312308
Composite(Box<AmqpComposite>),
313309
}
314310

315-
#[cfg(feature = "cplusplus")]
311+
#[cfg(feature = "ffi")]
316312
impl Serializable for AmqpValue {
317313
fn encoded_size(&self) -> Result<usize> {
318314
#[cfg(all(feature = "fe2o3_amqp", not(target_arch = "wasm32")))]
@@ -346,7 +342,7 @@ impl Serializable for AmqpValue {
346342
}
347343
}
348344

349-
#[cfg(feature = "cplusplus")]
345+
#[cfg(feature = "ffi")]
350346
impl Deserializable<AmqpValue> for AmqpValue {
351347
#[allow(unused_variables)]
352348
fn decode(data: &[u8]) -> azure_core::Result<AmqpValue> {
@@ -962,7 +958,7 @@ mod tests {
962958
}
963959

964960
#[test]
965-
#[cfg(feature = "cplusplus")]
961+
#[cfg(feature = "ffi")]
966962
fn amqp_composite() {
967963
let composite =
968964
AmqpComposite::new(0x270, AmqpList::from(vec![AmqpValue::from("String value")]));

0 commit comments

Comments
 (0)