Skip to content

Commit cd16d81

Browse files
committed
Remove deprecated c_enum! patterns
1 parent 7d6c5ab commit cd16d81

File tree

1 file changed

+20
-30
lines changed

1 file changed

+20
-30
lines changed

src/lib.rs

+20-30
Original file line numberDiff line numberDiff line change
@@ -168,18 +168,6 @@ macro_rules! c_enum {
168168
$name:ident = $num:expr,)* }) => {
169169
c_enum!($c_name, $(#[$enum_attr])* $enum_name { $( $(#[$attr])* $name = $num),* });
170170
};
171-
// Deprecated pattern.
172-
($doc:expr, $c_name:ident, $(#[$enum_attr:meta])* $enum_name:ident { $( $(#[$attr:meta])* value
173-
$name:ident = $num:expr),* }) => {
174-
c_enum!($c_name, #[doc = $doc] $(#[$enum_attr])*
175-
$enum_name { $( $(#[$attr])* $name = $num),* });
176-
};
177-
// Deprecated pattern.
178-
($doc:expr, $c_name:ident, $(#[$enum_attr:meta])* $enum_name:ident { $( $(#[$attr:meta])* value
179-
$name:ident = $num:expr,)* }) => {
180-
c_enum!($c_name, #[doc = $doc] $(#[$enum_attr])*
181-
$enum_name { $( $(#[$attr])* $name = $num),* });
182-
}
183171
}
184172

185173
////////////////////////
@@ -225,53 +213,55 @@ pub use tf::library;
225213

226214
////////////////////////
227215

228-
c_enum!("Error values that can be returned.", TF_Code, Code {
216+
c_enum!(TF_Code,
217+
/// Error values that can be returned.
218+
Code {
229219
/// Not an error; returned on success.
230-
value Ok = 0,
220+
Ok = 0,
231221

232222
/// The operation was cancelled (typically by the caller).
233-
value Cancelled = 1,
223+
Cancelled = 1,
234224

235225
/// Unknown error. An example of where this error may be returned is
236226
/// if a Status value received from another address space belongs to
237227
/// an error-space that is not known in this address space. Also
238228
/// errors raised by APIs that do not return enough error information
239229
/// may be converted to this error.
240-
value Unknown = 2,
230+
Unknown = 2,
241231

242232
/// Client specified an invalid argument. Note that this differs
243233
/// from FAILED_PRECONDITION. INVALID_ARGUMENT indicates arguments
244234
/// that are problematic regardless of the state of the system
245235
/// (e.g., a malformed file name).
246-
value InvalidArgument = 3,
236+
InvalidArgument = 3,
247237

248238
/// Deadline expired before operation could complete. For operations
249239
/// that change the state of the system, this error may be returned
250240
/// even if the operation has completed successfully. For example, a
251241
/// successful response from a server could have been delayed long
252242
/// enough for the deadline to expire.
253-
value DeadlineExceeded = 4,
243+
DeadlineExceeded = 4,
254244

255245
/// Some requested entity (e.g., file or directory) was not found.
256246
/// For privacy reasons, this code *may* be returned when the client
257247
/// does not have the access right to the entity.
258-
value NotFound = 5,
248+
NotFound = 5,
259249

260250
/// Some entity that we attempted to create (e.g., file or directory)
261251
/// already exists.
262-
value AlreadyExists = 6,
252+
AlreadyExists = 6,
263253

264254
/// The caller does not have permission to execute the specified
265255
/// operation. PERMISSION_DENIED must not be used for rejections
266256
/// caused by exhausting some resource (use RESOURCE_EXHAUSTED
267257
/// instead for those errors). PERMISSION_DENIED must not be
268258
/// used if the caller can not be identified (use UNAUTHENTICATED
269259
/// instead for those errors).
270-
value PermissionDenied = 7,
260+
PermissionDenied = 7,
271261

272262
/// Some resource has been exhausted, perhaps a per-user quota, or
273263
/// perhaps the entire file system is out of space.
274-
value ResourceExhausted = 8,
264+
ResourceExhausted = 8,
275265

276266
/// Operation was rejected because the system is not in a state
277267
/// required for the operation's execution. For example, directory
@@ -292,14 +282,14 @@ c_enum!("Error values that can be returned.", TF_Code, Code {
292282
/// REST Get/Update/Delete on a resource and the resource on the
293283
/// server does not match the condition. E.g., conflicting
294284
/// read-modify-write on the same resource.
295-
value FailedPrecondition = 9,
285+
FailedPrecondition = 9,
296286

297287
/// The operation was aborted, typically due to a concurrency issue
298288
/// like sequencer check failures, transaction aborts, etc.
299289
///
300290
/// See litmus test above for deciding between FAILED_PRECONDITION,
301291
/// ABORTED, and UNAVAILABLE.
302-
value Aborted = 10,
292+
Aborted = 10,
303293

304294
/// Operation tried to iterate past the valid input range. E.g., seeking or
305295
/// reading past end of file.
@@ -316,30 +306,30 @@ c_enum!("Error values that can be returned.", TF_Code, Code {
316306
/// error) when it applies so that callers who are iterating through
317307
/// a space can easily look for an OUT_OF_RANGE error to detect when
318308
/// they are done.
319-
value OutOfRange = 11,
309+
OutOfRange = 11,
320310

321311
/// Operation is not implemented or not supported/enabled in this service.
322-
value Unimplemented = 12,
312+
Unimplemented = 12,
323313

324314
/// Internal errors. Means some invariants expected by underlying
325315
/// system has been broken. If you see one of these errors,
326316
/// something is very broken.
327-
value Internal = 13,
317+
Internal = 13,
328318

329319
/// The service is currently unavailable. This is a most likely a
330320
/// transient condition and may be corrected by retrying with
331321
/// a backoff.
332322
///
333323
/// See litmus test above for deciding between FAILED_PRECONDITION,
334324
/// ABORTED, and UNAVAILABLE.
335-
value Unavailable = 14,
325+
Unavailable = 14,
336326

337327
/// Unrecoverable data loss or corruption.
338-
value DataLoss = 15,
328+
DataLoss = 15,
339329

340330
/// The request does not have valid authentication credentials for the
341331
/// operation.
342-
value Unauthenticated = 16,
332+
Unauthenticated = 16,
343333
});
344334

345335
////////////////////////

0 commit comments

Comments
 (0)