[wpilibc] Use std::string_view instead of Twine (#3380)

Use fmtlib where needed for string formatting into std::string_view.
This commit is contained in:
Peter Johnson
2021-05-26 17:44:18 -07:00
committed by GitHub
parent 50915cb7ed
commit 4e2c3051be
76 changed files with 387 additions and 419 deletions

View File

@@ -5,10 +5,9 @@
#pragma once
#include <string>
#include <string_view>
#include <hal/Types.h>
#include <wpi/StringRef.h>
#include <wpi/Twine.h>
#include <wpi/deprecated.h>
namespace frc {
@@ -82,7 +81,7 @@ class SerialPort {
* @param stopBits The number of stop bits to use as defined by the enum
* StopBits.
*/
SerialPort(int baudRate, const wpi::Twine& portName, Port port = kOnboard,
SerialPort(int baudRate, std::string_view portName, Port port = kOnboard,
int dataBits = 8, Parity parity = kParity_None,
StopBits stopBits = kStopBits_One);
@@ -148,7 +147,7 @@ class SerialPort {
* @param buffer StringRef to the buffer to read the bytes from.
* @return The number of bytes actually written into the port.
*/
int Write(wpi::StringRef buffer);
int Write(std::string_view buffer);
/**
* Configure the timeout of the serial port.